Python 2.x and 3.x usage survey

David bouncingcats at gmail.com
Wed Jan 1 09:07:54 EST 2014


On 1 January 2014 23:38, Steve Hayes <hayesstw at telkomsa.net> wrote:
>
> I was thinking or of this:
>
>>>> python g:\work\module1.py
>   File "<stdin>", line 1
>     python g:\work\module1.py
>            ^
>
> Which gave a different error the previous time I did it.
>
> But, hey, it worked from the DOS prompt
>
> C:\Python32>python g:\work\module1.py
> Hello Module World

Your windows command shell prompt looks like this: "C:\Python32>"
It indicates that windows shell is waiting for you to type something.
It expects the first word you type to be an executable command. If you
do this:
  C:\Python32>python g:\work\module1.py
it tells the shell to run the python interpreter and feed it all the
python statments contained in the file g:\work\module1.py

If you do this:
  C:\Python32>python
it tells the shell to run the python interpreter interactively, and
wait for you to directly type python statements. When the python
intepreter is ready for you to type a python statement, it gives you a
">>>" prompt. It expects you to type a valid python language
statement.

The reason this gave an error:
>>> python g:\work\module1.py

is because you are using the python interpreter as shown by ">>>", but
you typed a windows shell command, not a python statement.



More information about the Python-list mailing list