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


Groups > comp.lang.python > #70508

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.fsmpi.rwth-aachen.de!rt.uk.eu.org!newsfeed.xs4all.nl!newsfeed2a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <rosuav@gmail.com>
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:error': 0.03; '22,': 0.09; 'subject: [': 0.09; 'subject:script': 0.09; 'works.': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; '14:26,': 0.16; 'ah!': 0.16; 'excellent!': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'specific,': 0.16; 'subject: \n ': 0.16; 'subject:when': 0.16; 'skip:# 20': 0.16; 'wrote:': 0.18; 'bit': 0.19; '>>>': 0.22; 'cc:addr:python.org': 0.22; '"you': 0.24; 'case.': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; "doesn't": 0.30; 'message- id:@mail.gmail.com': 0.30; 'python"': 0.31; 'problem': 0.35; 'received:google.com': 0.35; 'should': 0.36; 'subject:]': 0.38; 'pm,': 0.38; 'rather': 0.38; 'changed': 0.39; 'first': 0.61; 'more': 0.64; 'yes': 0.68; 'pardon': 0.84; 'use"': 0.91; 'to:none': 0.92
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc :content-type; bh=SdbbyzFloOhmFcHjRnMzX6MIoSDrO1+9p+mLmvqw15g=; b=iZnkYJakkTAv1o52riWZ411HOs275v+Aid46lfdfsel1hy7JsxOMPyHiU3jtf8w+M6 2tfYcRwu7v/tms8MWjlTgibiiOfHdsHI+Da00TLMGVoiAQ2e9SK+bhDdFoJz1yGqAQia xzqvWiz9o24MGBCwaFzh41tdxndW4hs4PqauQjIL+IgcIJumiewrvFj/nygksuvTZVgs j6HeNhOHEkdsDN5XROZn1joqvWPQ8MIIakWdzVlll5JSoZ9iS24qCw37ExFNn5yLmrcr QFTdtbuc+g6x4IckNgHfk58VROLceCwKjbnF+aCQRUdPBDsWu9Gm/PMzMl7ITukAnEDf u1fg==
MIME-Version 1.0
X-Received by 10.58.38.40 with SMTP id d8mr3571vek.61.1398172051844; Tue, 22 Apr 2014 06:07:31 -0700 (PDT)
In-Reply-To <53566839.9010508@rece.vub.ac.be>
References <535644A4.6060901@rece.vub.ac.be> <CAPTjJmoXsBDf6kwWk8EqqkX7N+n++t_P87VVVROc1OcW_N9K8g@mail.gmail.com> <53565ECE.2060307@rece.vub.ac.be> <CAPTjJmqvZRUwjTTc6ND8tK5fieoH-8UY0R2YJxNYjbm6_jXMrQ@mail.gmail.com> <53566839.9010508@rece.vub.ac.be>
Date Tue, 22 Apr 2014 23:07:31 +1000
Subject Re: Strange syntax error, occurs only when script is executed directly [solved]
From Chris Angelico <rosuav@gmail.com>
Cc "python-list@python.org" <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
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.9440.1398172053.18130.python-list@python.org> (permalink)
Lines 20
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398172053 news.xs4all.nl 2884 [2001:888:2000:d::a6]:36313
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70508

Show key headers only | View raw


On Tue, Apr 22, 2014 at 11:01 PM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
> On 22-04-14 14: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.
>
> The problem with that is that it doesn't work if python is not on
> the (standard) path, like in this case.

Ah! Well, that's why I said "consider using" rather than "you should use" :)

ChrisA

Back to comp.lang.python | Previous | Next | 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 23:07 +1000

csiph-web