djones7936
Programmer
Hello,
I'm new to Python.
When I open a fresh shell and type:
>>> import random
>>> print random.random()
the code works.
If I put those same two lines into a .py file and try to run the program (both from the command line or from a new window in Python's shell), I get an error message.
Traceback (most recent call last):
File "<string>", line 1, in ?
File "F:\USER\Programming\Python\learning\random.py", line 2, in ?
print random.random()
TypeError: 'module' object is not callable
Why does it do that/how can I get around that?
Python is installed at F:\Program Files\Python22
the code is stored in F:\User\programming\python\learning\random.py
Help!
-Dave
I'm new to Python.
When I open a fresh shell and type:
>>> import random
>>> print random.random()
the code works.
If I put those same two lines into a .py file and try to run the program (both from the command line or from a new window in Python's shell), I get an error message.
Traceback (most recent call last):
File "<string>", line 1, in ?
File "F:\USER\Programming\Python\learning\random.py", line 2, in ?
print random.random()
TypeError: 'module' object is not callable
Why does it do that/how can I get around that?
Python is installed at F:\Program Files\Python22
the code is stored in F:\User\programming\python\learning\random.py
Help!
-Dave