So I'm new to python, although not terribly new to programming. I am going through some tutorials, but am having some trouble.
I am trying to execute a program from the python shell (using Python 3.1). Right now, I have the >>> prompt. I can't seem to get any program to execute from this prompt. If I put my program into a new window and then click "Run Module," it works. But I can't get it to execute from the >>> prompt in the shell.
I have tried these variations (note - my module name is humansize.py and this is stored in a folder located at C:/Python31/Examples):
>>> import sys
>>> humansize
Traceback (most recent call last):
File "<pyshell#5>", line 1, in <module>
humansize
NameError: name 'humansize' is not defined
>>> humansize.py
Traceback (most recent call last):
File "<pyshell#6>", line 1, in <module>
humansize.py
NameError: name 'humansize' is not defined
>>> import sys
>>> sys.path
>>> sys
<module 'sys' (built-in)>
>>> sys.path.insert(0,'Python31/Examples')
>>> sys
<module 'sys' (built-in)>
>>> sys.path
>>> execfile(humansize.py)
Traceback (most recent call last):
File "<pyshell#13>", line 1, in <module>
execfile(humansize.py)
NameError: name 'execfile' is not defined
>>> execfile(humansize)
Traceback (most recent call last):
File "<pyshell#14>", line 1, in <module>
execfile(humansize)
NameError: name 'execfile' is not defined
>>> execfile('humansize.py')
Traceback (most recent call last):
File "<pyshell#15>", line 1, in <module>
execfile('humansize.py')
NameError: name 'execfile' is not defined
>>> execfile('humansize')
Traceback (most recent call last):
File "<pyshell#16>", line 1, in <module>
execfile('humansize')
NameError: name 'execfile' is not defined
>>> import sys
>>> C:\Python31\python.exe humansize.py
SyntaxError: invalid syntax
>>> python.eye humansize.py
SyntaxError: invalid syntax
>>>
So what am I doing wrong??????