A simple print cannot run in Python Shell

Tim Golden mail at timgolden.me.uk
Mon Jun 1 04:46:50 EDT 2015


On 01/06/2015 09:30, Steven D'Aprano wrote:
> How do you run it in Windows 7? The hashbang line
> 
>     #!/usr/bin/python
> 
> is for Linux and Unix, and won't work on Windows. So you must be doing 
> something to execute the file. What is that?

Actually, it will for anywhere with a recent Python 3.x or where the
standalone launcher has been installed:

https://www.python.org/dev/peps/pep-0397/
(cf particularly the section "Python Script Launching")

Of course, I don't know if the OP does in fact have
the launcher installed, but if they do then the answer is: py.exe.

Even if the launcher isn't installed, Windows will happily run a .py
file via the file extension association, assuming that this has been
selected when installing Python (which it is, by default, ISTR).

TJG



More information about the Python-list mailing list