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


Groups > comp.lang.python > #70525

Re: Strange syntax error, occurs only when script is executed directly [solved]

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.datemas.de!rt.uk.eu.org!news.roellig-ltd.de!open-news-network.org!cyclone03.ams2.highwinds-media.com!news.highwinds-media.com!voer-me.highwinds-media.com!peer03.am1!peering.am1!npeersf04.am4!fx02.am4.POSTED!not-for-mail
From Andrew Cooper <root@127.0.0.1>
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.4.0
MIME-Version 1.0
Newsgroups comp.lang.python
Subject Re: Strange syntax error, occurs only when script is executed directly [solved]
References <535644A4.6060901@rece.vub.ac.be> <CAPTjJmoXsBDf6kwWk8EqqkX7N+n++t_P87VVVROc1OcW_N9K8g@mail.gmail.com> <53565ECE.2060307@rece.vub.ac.be> <mailman.9437.1398169617.18130.python-list@python.org>
In-Reply-To <mailman.9437.1398169617.18130.python-list@python.org>
Content-Type text/plain; charset=UTF-8
Content-Transfer-Encoding 7bit
Lines 27
Message-ID <cUE5v.46172$_m3.5204@fx02.am4> (permalink)
NNTP-Posting-Host 82.25.227.93
X-Complaints-To http://netreport.virginmedia.com
X-Trace 1398217352 82.25.227.93 (Wed, 23 Apr 2014 01:42:32 UTC)
NNTP-Posting-Date Wed, 23 Apr 2014 01:42:32 UTC
Organization virginmedia.com
Date Wed, 23 Apr 2014 02:42:36 +0100
X-Received-Body-CRC 2280735068
X-Received-Bytes 1919
Xref csiph.com comp.lang.python:70525

Show key headers only | View raw


On 22/04/2q014 13:26, Chris Angelico wrote:
> On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon
> <antoon.pardon@rece.vub.ac.be> wrote:
>> Yes that was it. I changed the first line of my script to:
>>
>> #!/opt/local/bin/python2.7
>>
>> and it now works.
> 
> Excellent! Shebangs are *extremely* specific, so you may want to
> consider using "/usr/bin/env python" to get a bit more flexibility.
> (Or "python2" or "python2.7" in place of "python", depending on how
> specific you want to be.)
> 
> ChrisA
> 

`man execve`

"The interpreter must be a valid pathname for an executable which is not
itself a script."

This is (presumably) to avoid recursive walks of the filesystem trying
to locate a valid interpreter to splat over the virtual address space of
the currently executing process.

~Andrew

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


Thread

Re: Strange syntax error, occurs only when script is executed directly [solved] Chris Angelico <rosuav@gmail.com> - 2014-04-22 22:26 +1000
  Re: Strange syntax error, occurs only when script is executed directly [solved] Andrew Cooper <root@127.0.0.1> - 2014-04-23 02:42 +0100
  Re: Strange syntax error, occurs only when script is executed directly [solved] Andrew Cooper <root@127.0.0.1> - 2014-04-23 02:42 +0100

csiph-web