[Tutor] Running files from command prompt
Alexander Quest
redacted@example.com
Fri Jul 29 03:58:47 CEST 2011
I downloaded the google's python exercise files from their website (
http://code.google.com/edu/languages/google-python-class/set-up.html),
unzipped them, and placed them in C.
I then added the following to the PATH variable under system settings so
that I could type "python" in command prompt and have Windows start the
interpreter: C:\Python31;C:\Python31\Tools\Scripts
When I type in "python" in the command prompt, the interpreter opens, but
when I try to open one of the programs from the Google exercise files
(hello.py), I get the following error:
Traceback <most recent call last>:
File "<stdin>", line 1, in <module>
NameError: name 'hello' is not defined
Or, if I just type in "python hello.py" first in the command prompt (as
opposed to typing in python, hitting enter, and THEN typing in hello.py, as
above), I get the following error:
python: can't open file 'hello.py': [Errno 2] No such file or directory.
So I guess my question is how do I run .py files from the command prompt now
that I seem to have gotten Windows to recognize and open the interpreter
when I type in "python"? Thanks for any help.
-Alex
P.S. Just as an aside, when I open up the command prompt, the initial
directory is C:\Users\Alexander, but my google exercises are in
C:\google-python-exercises and python itself is in C:\Python31. I don't know
if this makes a difference or not.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20110728/edc6d4d7/attachment.html>
More information about the Tutor
mailing list
l>