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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!1.eu.feeder.erje.net!ecngs!feeder2.ecngs.de!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <mail@timgolden.me.uk>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.002
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:Python': 0.05; 'that?': 0.05; 'python': 0.11; '"python': 0.16; '.py': 0.16; 'association,': 0.16; 'from:addr:timgolden.me.uk': 0.16; 'from:name:tim golden': 0.16; 'happily': 0.16; 'message- id:@timgolden.me.uk': 0.16; 'received:74.55.86': 0.16; 'received:74.55.86.74': 0.16; 'received:smtp.webfaction.com': 0.16; 'received:webfaction.com': 0.16; 'subject:run': 0.16; 'subject:simple': 0.16; 'tjg': 0.16; 'wrote:': 0.16; 'windows': 0.20; 'extension': 0.20; '3.x': 0.22; 'assuming': 0.22; 'default,': 0.22; 'file.': 0.24; 'header:In-Reply-To:1': 0.24; 'script': 0.25; 'header:User-Agent:1': 0.26; 'linux': 0.26; 'skip:# 10': 0.27; 'url:dev': 0.27; 'installed,': 0.29; 'unix,': 0.29; 'url:peps': 0.29; '(which': 0.29; 'anywhere': 0.30; 'run': 0.32; 'url:python': 0.33; "d'aprano": 0.33; 'received:192.168.100': 0.33; 'steven': 0.33; 'windows.': 0.33; 'file': 0.34; 'to:addr:python-list': 0.35; 'installing': 0.35; 'something': 0.35; "isn't": 0.35; 'but': 0.36; 'url:org': 0.36; 'subject:: ': 0.37; "won't": 0.38; 'doing': 0.38; 'is,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'where': 0.40; 'even': 0.61; 'from:addr:mail': 0.70; 'actually,': 0.84
Date Mon, 01 Jun 2015 09:46:50 +0100
From Tim Golden <mail@timgolden.me.uk>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.0
MIME-Version 1.0
To python-list@python.org
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>
In-Reply-To <556c1826$0$13004$c3e8da3$5496439d@news.astraweb.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.274.1433148415.5151.python-list@python.org> (permalink)
Lines 22
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433148415 news.xs4all.nl 2860 [2001:888:2000:d::a6]:34353
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:91635

Show key headers only | 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