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

References <535644A4.6060901@rece.vub.ac.be>
Date 2014-04-22 22:09 +1000
Subject Re: Strange syntax error, occurs only when script is executed directly
From Chris Angelico <rosuav@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.9435.1398168600.18130.python-list@python.org> (permalink)

Show all headers | 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