Question about dir function

2009-12-19 Thread Ray Holt
When I run a dir(_builtins_) I get the error message that the name _builtins_ is not defined. I haven't tried the dir function on other functions, but can someone tell me why I am getting this message? Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Invalid syntax error

2009-12-20 Thread Ray Holt
Why am I getting an invalid syntax error on the following: os.chdir(c:\\Python_Modules). The error message says the colon after c is invalid syntax. Why is it saying this when I am trying to change directory to c:\Python_Modules. Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Opening File Object

2009-12-21 Thread Ray Holt
e 5, in fileobject = open("E:\\Ray Holts Documents\Word Documents\\1850 Warren MS Jenkins", 'r') IOError: [Errno 2] No such file or directory: 'E:\\Ray Holts Documents\\Word Documents\\1850 Warren MS Jenkins' I know the file exists because I opened i

Invalid Syntax Error

2010-01-14 Thread Ray Holt
Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, "w" except IOError: print "There was an error writing to", file_name sys.exit() pri

Why am I getting this Error message

2010-01-28 Thread Ray Holt
Why am I getting the following error message. Area has been declared as an attribute of Circle. Thanks, Ray class Circle: def __init__(self): self.radius = 1 def area(self): return self.radius * self.radius * 3.14159 c = Circle() c.radius = 3 print c.area() Traceback (most rece

Program to compute and print 1000th prime number

2009-11-07 Thread Ray Holt
I am taking the MIT online course Introduction to Computer Science and Programming. I have a assignment to write a program to compute and print the 1000th. prime number. Can someone give me some leads on the correct code? Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Indentation problems

2009-11-08 Thread Ray Holt
I am having problems with indentation some times. When I hit the enter key after if statements or while statemt there are times when the indentation is too much and other times too little. When I try to manually make sure the indentation is correct and try to print, I ge the error message of invali

Commenting and uncommenting from the shell

2009-11-08 Thread Ray Holt
Can you comment and uncomment code from the shell. I know that the format meny only shows in the edit window. I tried crtl + 3, which is what it said in the configuration window to use, and nothing happens. Also can you write executable code from the edit window. I can't see to get code that I writ

Computing the 1000th prime

2009-11-12 Thread Ray Holt
I have an assigment to find the 1000th. prime using python. What's wrong with the following code: PrimeCount = 0 PrimeCandidate = 1 while PrimeCount < 2000: IsPrime = True PrimeCandidate = PrimeCandidate + 2 for x in range(2, PrimeCandidate): if PrimeCandidate % x == 0: ##

pythonpath

2009-11-21 Thread Ray Holt
Is there a way to make python point to a different directory for modules. I don't like to keep my modules in the program directory, but I can't figure out from the shell how to get the program to look in another directory. I am using XP Pro as an operating system and python2.6 -- http://mail.pytho

Why this error message

2010-01-31 Thread Ray Holt
Why am I getting the error that test is not defined. Thanks, Ray class SpecialFile: def __init__(self, fileName): self.__file = open(fileName, 'W') self.__file.write('* Start Special File *\n\n') def write(self, str): self.__file.write(str) def writeline

Why this error message

2010-02-01 Thread Ray Holt
Guys, I apologize for the last email asking for help I am going to have to remember to check my indentation. Ray -- http://mail.python.org/mailman/listinfo/python-list