15,185 Topics

Member Avatar for
Member Avatar for lrh9

I want to call another object's methods from another object, and I have no idea how. Can someone please help me? Thank you.

Member Avatar for lrh9
0
202
Member Avatar for SoulMazer

Hi, I'm looking for a little help with the function "getattr". Here's my code: [code=python]class MyClass: def __init__(self): trycmd = getattr(self, "cmd_testing") try: trycmd() except: print "Fail." def cmd_testing(self): print "Victory!" obj = MyClass()[/code] So, when I run this code, I get the output "Fail.". I'm not sure what I'm …

Member Avatar for vegaseat
1
138
Member Avatar for redpython

I am new to Python and am trying to marry a Python module with a CGI interface. I understand a little of both but not how they work together. I created a class called Vehicle and (using IDLE) and am able to import it and set the year, make, and …

0
61
Member Avatar for simpatar

Alright, this is how my newest program looks like: [CODE]import math def main(): print('This program finds the real solutions to a quadratic') print s = float(input('Please enter the coefficients (a,b,c): ')) a, b, c = s.split(',') discRoot = float(math.sqrt(b * b - 4 * a * c)) root1 = (-b …

Member Avatar for vegaseat
0
79
Member Avatar for nevets04

I finally got apache installed. I moved my .cgi python web application to var/www/cgi-bin however when I went to 127.0.0.1/cgi-bin/web.cgi but it said the web address didn't exsist. So I put the file in in var/www/ and it just read what was in the script, it didnt execute it. So …

Member Avatar for jlm699
0
196
Member Avatar for gsingh2011

This is my python script: [url]http://gsingh.pastebin.com/mc602006[/url] This is my setup.py file for py2exe: [url]http://gsingh.pastebin.com/m70a19449[/url] When I go to command prompt and run the .py file with the command, email.py message It works fine, it sends me an email with the message, which is what it's supposed to do. When I …

Member Avatar for snippsat
0
652
Member Avatar for saikeraku

hi, im trying to make a program that simulates the game Risk. It should output something like this: [code] Attacking Army: Army A Defending Army: Army B Number of attacking army: 4 Number of defending army: 3 ----------------------------------- Round 1: Army A: 3, Army B: 2 Attackers' Dice: 5 2 …

Member Avatar for woooee
0
90
Member Avatar for tlj333

I read the guidelines on posting homework questions and I think this one is within the rules. A little background, currently taking my first computer program class, its an online class (big mistake), it's very hard to get feedback or assistance. I have been ripping my hair out trying to …

Member Avatar for tlj333
0
192
Member Avatar for rmsagar

In my file, I have lines similar to this <Log LogID="633198520" LogLevel="Normal" Date="10/01/09 19:18" Type="Error" Source="Mentor" Text="Failed to process the request." /> When the line is read, if it is converted as field value pair I thought it will be easy to take required field. Please advise how this can …

Member Avatar for rmsagar
0
116
Member Avatar for MkeVaughanG

I need to gather data from a weather rss feed. But i ONly need certain "Variables, such as humidity, temp (high and low) etc. What I want to do is (i think) is parse them from Rss to integers in python. Any help would be much appreciated. :)

Member Avatar for lrh9
0
39
Member Avatar for kat12

Hey, I'm brand new to Python and I'm sorry if my code/question is sloppy and ridiculous. I had to make a snowman for homework, but now I have to make the entire snowman move 6 times wherever the user clicks. I used this at first, but it obviously only moves …

Member Avatar for vegaseat
0
1K
Member Avatar for Jehanneman

Hi everyone! I'm trying to make a function in Python that converts a csv file into a xls file. I have to convert about 500 files so you understand that I need it to be as clean as possible. This is the code I wrote, just for one file later …

Member Avatar for ramwins1
0
728
Member Avatar for mohankumar554

hi, i want to develop small games using python on mac. so which modules /libraries i have to import . and how to proceed to develop the game... plz tell me.

Member Avatar for jlm699
0
88
Member Avatar for nicsmr

description: Reading data from active directory. some names have the French accented E. when I write to screen, no problems. when I write to a .txt file the program errors out with... [I]Traceback (most recent call last): File "ad-listing.py", line 20, in <module> print >> OutFile, person.displayname,"~",person.title,\ UnicodeEncodeError: 'ascii' codec …

Member Avatar for vegaseat
0
127
Member Avatar for python.noob

though i'm calling pr() function in the subclass after calling the get_details() function(which assigns value to name) it doesn't print the current value of name. My question is if i want to print the value of name in the subclass what should i do???? I've tried in many ways using …

Member Avatar for AutoPython
0
220
Member Avatar for simpatar

Here is my program: [I]#avg2.py # A simple program to average two exam scores # Illustrates use of multiple input def main(): print('This is a program to average two exam scores') score1, score2 = float(input('Enter two scores separated by a comma: ')) average = (score1 + score2) / 2.0 print('The …

Member Avatar for The_Kernel
0
165
Member Avatar for srk619

ive got a sample game from college and i would like to open it a see how the game is but when i open it a blank window appears like ms dos and then closes i wonder if anyone could help out. ive installed python 2.5 and pygame. the code …

Member Avatar for snippsat
0
93
Member Avatar for AnonSurf

Having trouble getting code to allow the cars to go off screen then come back on the opposite side of the screen! for top to bottom and side to side! -The code i was trying was [CODE]if self.position > rect.top self.position == rect.bottom[/CODE] not sure if this is gonna work …

Member Avatar for AnonSurf
0
160
Member Avatar for mohankumar554

hi, how to implement the web services in python. I know, two protocols SOAP and WSDL are used in web services but i don't know how to use them to implement the web services . so can anyone tell me how to implement and develop the web services..

Member Avatar for lightspeed1234
-1
89
Member Avatar for fferrandini

Hello, I got a python script to send emails for my clients , that script is fired whenever i got new products in the store. i have like 4000 emails, but the server pops me an error when it hits the 1000 email. The error says the limit is 1000. …

Member Avatar for Gribouillis
0
190
Member Avatar for hdk

Hi, I am having trouble producing my chart in the wx python gui. Keeps giving me an "ABORTED" message. Could you help if possible please? Code below : [CODE]import wx import cx_Oracle import datetime import wx.grid import csv import numpy as np import matplotlib.pyplot as plt import matplotlib.mlab as mlab …

Member Avatar for hdk
0
401
Member Avatar for rui_esi

Hi, Newbie to this python lark so please forgive any silly questions - thank! Have installed various versions of python from 2.4 to 2.6 all with same issue. Current install is 2.5.4 AMD64 on XP64 platform. Python IDE doesn't do anything at all Python command line reports >> 'import site' …

Member Avatar for rui_esi
0
2K
Member Avatar for Pythonn

HI guys, I am having some trouble with some basic python. I need to make a function that reads a document and divides each sentence up and counts the lenght of the largest sentence. this is what i have so far def linesize(F): c= 0 W= open("file.txt") X= W.read() Xlines …

Member Avatar for masterofpuppets
0
101
Member Avatar for lrh9

Is it a good idea to help people with object oriented software design and code? I'm asking this because most of the code here is written using the functional programming, and all could probably improve a little or a lot with object oriented design and coding. My first doubt about …

Member Avatar for Gribouillis
0
94
Member Avatar for Gribouillis

Does anyone know how I can test if an object's type is a builtin type or a user defined type ?

Member Avatar for Gribouillis
0
167
Member Avatar for OldGrantonian

As an amateur weekend programmer, I find that the easist way to learn how a program works is to step through the program using my IDE debugger. Using breakpoints is obviously the best way to step over code that doesn't interest me. My problem is that in some large programs, …

Member Avatar for OldGrantonian
0
80
Member Avatar for rociel

Hello, I am trying to make a program to calculate the payment for a babysitter like this: A babysitter charges $5 an hour until 9:00 p.m., at which point the rate drops to $3 an hour because the kids are in bed # the start and end times are in …

Member Avatar for snippsat
0
489
Member Avatar for alxw1711

Hello, I am fairly new to python and in process of taking a class on Natural Language Processing and the language itself. I would sure appreciate any help at all on this current assignment. I'm having trouble trying to understand how I should start this program or how it all …

0
42
Member Avatar for Stefano Mtangoo

Hi All, I'm curious to know what is the difference as well as recommendation for two beasts :) Is it Panda or Pygame and why?

Member Avatar for Stefano Mtangoo
0
125
Member Avatar for kiddo39

I have an array of numbers and want to print out how many of each number there are in the array. My method works but I was wondering what a more efficient way of doing this would be. I figure a loop would work but I haven't figured out how …

Member Avatar for kiddo39
0
117

The End.