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


Groups > comp.lang.python > #70504

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!xlned.com!feeder7.xlned.com!newsfeed.xs4all.nl!newsfeed3.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.003
X-Spam-Evidence '*H*': 0.99; '*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.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; 'cc:addr:python.org': 0.22; '(or': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply-To:1': 0.27; 'message- id:@mail.gmail.com': 0.30; 'python"': 0.31; 'received:google.com': 0.35; 'subject:]': 0.38; 'pm,': 0.38; 'changed': 0.39; 'how': 0.40; 'first': 0.61; 'more': 0.64; 'yes': 0.68; 'pardon': 0.84; '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=DNUAaiNRIWOWbj/E3B7ecQUtIqJhCRsOdsNVqxsmCt0=; b=kTgxVfdnnyHbU/YqbccFwqrw2yBKmmRiHLjolKz7xwAcCXsSvXp12FpTxlWxfN+c+2 CuygFhWj+ufdTKxbBy9j43I1o+EO0kBQusj5OhM/zkXAxgfHSKih9FQV+Q5gXSOakuVC cpVvC6b5eVBUIQ/ua8BGfS2ghYSyqqC6CgmTnZGnEgUL07fGbmMgV/6b2rRfrBQmIkHj a0Fl72bp6h+QktE24NZRrcXBA3RF5O/DZj9+xuXY/FDxX/oAzQ03eINCLEpDDUziYofH tIcA7+Cw2UR9lzJlne3DK0kIVUlLYSJjRpxRLdWawymLEQ1r9kGX4pRORs8/zcGhVBv1 8mbA==
MIME-Version 1.0
X-Received by 10.58.134.101 with SMTP id pj5mr109024veb.38.1398169614266; Tue, 22 Apr 2014 05:26:54 -0700 (PDT)
In-Reply-To <53565ECE.2060307@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>
Date Tue, 22 Apr 2014 22:26:54 +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.9437.1398169617.18130.python-list@python.org> (permalink)
Lines 14
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398169617 news.xs4all.nl 2832 [2001:888:2000:d::a6]:50752
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70504

Show key headers only | View raw


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

Back to comp.lang.python | Previous | NextNext 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