[Tutor] Code query..works in IDLE but not DrPython editor

Tony Noyeaux tnoyeaux at msn.com
Tue Jul 10 19:37:34 CEST 2007


Simple Random code.
 
 
import randomprint random.choice(['Apple', 'Pear', 'Shrimp', 'Death', 'Life'])
 
 
Works in IDLE gui, no problem. Gives me a random pick no problem.
 
When i changed to DrPython, to continue building parts of my code.. it won't take that code.
 
Gives me this error.
 
C:/Python/pythonw.exe -u  "C:/Python25/random.py"Traceback (most recent call last):  File "C:/Python25/random.py", line 1, in <module>    import random  File "C:\Python25\random.py", line 2, in <module>    print random.choice(['Apple', 'Pear', 'Shrimp', 'Death', 'Life'])AttributeError: 'module' object has no attribute 'choice'
 
... not sure why one editor would work, and while the other won't?.. any suggestions.
 
Looking for some insight.
_________________________________________________________________
See what you’re getting into…before you go there.
http://newlivehotmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070710/0641681a/attachment.htm 


More information about the Tutor mailing list