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


Groups > comp.lang.python > #70501

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

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin1!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed1.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.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'subject:error': 0.03; 'syntax': 0.04; 'processing.': 0.07; '22,': 0.09; 'bash': 0.09; 'counting': 0.09; 'subject:script': 0.09; 'cc:addr:python-list': 0.11; 'python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'subject:when': 0.16; 'symlink': 0.16; 'unexpected': 0.16; 'wrote:': 0.18; 'trying': 0.19; 'code,': 0.22; 'cc:addr:python.org': 0.22; 'error': 0.23; 'script.': 0.24; 'looks': 0.24; 'cc:2**0': 0.24; 'script': 0.25; 'header:In-Reply- To:1': 0.27; 'message-id:@mail.gmail.com': 0.30; 'run': 0.32; '(including': 0.33; "i'd": 0.34; 'problem.': 0.35; 'something': 0.35; 'received:google.com': 0.35; 'error.': 0.37; 'wrong': 0.37; 'being': 0.38; 'pm,': 0.38; 'itself': 0.39; 'such': 0.63; 'maximum': 0.63; '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=/QeDrAOsv9h8zsDbJz+J0a1Gbvi8HLNdcbfVNEw3KHg=; b=FTGSDpnd7QzwKylb1YNpzsBsS3yOLRR11cHtevQkjTHwU4Kt/fgpa4PvnbD+JrkHzX RScuMGOPJWXSjkSvHVZs/NO3kYShASUSfq8/Ry2FxeYtGREDwMo0YX7V7Zou+rTqnDl/ liYqNf3Z9XIxVEKMLHcIi4PEC+ylPt/wL9Z3PGVU9pJ5umudQNRZQCNLcvwhZtiSoyRW UoAmu5g5K28vlTPBp90B+iagUdWbX1Q0B2zqzeGG0ufRHQc1/zsUTE1Rp3RvFxDJTgqZ NlW9+Sg0tpn2UmVOqWZFe8vEuaUqb8aIP1SDTVgWwZuCL58q+qoXXJXXtdvaPjvwZp2p aibQ==
MIME-Version 1.0
X-Received by 10.220.95.204 with SMTP id e12mr114778vcn.37.1398168592667; Tue, 22 Apr 2014 05:09:52 -0700 (PDT)
In-Reply-To <535644A4.6060901@rece.vub.ac.be>
References <535644A4.6060901@rece.vub.ac.be>
Date Tue, 22 Apr 2014 22:09:52 +1000
Subject Re: Strange syntax error, occurs only when script is executed directly
From Chris Angelico <rosuav@gmail.com>
Cc Pyton List <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.9435.1398168600.18130.python-list@python.org> (permalink)
Lines 17
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1398168600 news.xs4all.nl 2927 [2001:888:2000:d::a6]:43058
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:70501

Show key headers only | View raw


On Tue, Apr 22, 2014 at 8:29 PM, Antoon Pardon
<antoon.pardon@rece.vub.ac.be> wrote:
> However if I call the script directly and want the #! line do its work I get the following error.
>
> # /usr/local/bin/ldapwatch /opt/local/log/openldap.log | head
> /usr/local/bin/ldapwatch: line 3: syntax error near unexpected token `('
> /usr/local/bin/ldapwatch: line 3: `class vslice(object):'

That looks like bash trying to run Python code, so I'd look at
something being wrong with the shebang processing. What's
/opt/local/bin/python? Is it a symlink to something else? Some systems
won't allow any such dereferencing, others (including modern Linux)
allow a maximum of ten or thereabouts, counting one for every symlink
or shebang'd script. If /opt/local/bin/python is a bouncer script that
itself has a shebang, that might be your problem.

ChrisA

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


Thread

Re: Strange syntax error, occurs only when script is executed directly Chris Angelico <rosuav@gmail.com> - 2014-04-22 22:09 +1000

csiph-web