Python 2.x and 3.x usage survey

Chris Angelico rosuav at gmail.com
Wed Jan 1 07:39:57 EST 2014


On Wed, Jan 1, 2014 at 11:38 PM, 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

That's how you invoke a script. Python isn't fundamentally a shell
scripting language (like bash, REXX, batch, etc), so there's a
distinct difference between Python commands (which go into .py files
or are executed at the ">>>" prompt) and shell commands (including
"python", which invokes the Python interpreter).

> The biggest problem I have is that when something doesn't work, I don't know
> if I have done something stupid, or if it's just an incompatibility of the
> different versions.

Easiest way to eliminate the confusion is to match your tutorial and
your interpreter. That's why I recommend going with the python.org
tutorial; you can drop down the little box in the top left and choose
the exact version of Python that you're running. It WILL match.

ChrisA



More information about the Python-list mailing list