Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #91635

Re: A simple print cannot run in Python Shell

Date 2015-06-01 09:46 +0100
From Tim Golden <mail@timgolden.me.uk>
Subject Re: A simple print cannot run in Python Shell
References <caa1cc9e-2f9b-423d-9298-a511180d15f7@googlegroups.com> <556c1826$0$13004$c3e8da3$5496439d@news.astraweb.com>
Newsgroups comp.lang.python
Message-ID <mailman.274.1433148415.5151.python-list@python.org> (permalink)

Show all headers | View raw


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

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

A simple print cannot run in Python Shell fl <rxjwg98@gmail.com> - 2015-06-01 00:50 -0700
  Re: A simple print cannot run in Python Shell Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2015-06-01 10:59 +0300
  Re: A simple print cannot run in Python Shell Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-06-01 18:30 +1000
    Re: A simple print cannot run in Python Shell Tim Golden <mail@timgolden.me.uk> - 2015-06-01 09:46 +0100

csiph-web