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


Groups > comp.lang.python > #70503 > unrolled thread

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

Started byAntoon Pardon <antoon.pardon@rece.vub.ac.be>
First post2014-04-22 14:21 +0200
Last post2014-04-22 14:21 +0200
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Strange syntax error, occurs only when script is executed directly [solved] Antoon Pardon <antoon.pardon@rece.vub.ac.be> - 2014-04-22 14:21 +0200

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

FromAntoon Pardon <antoon.pardon@rece.vub.ac.be>
Date2014-04-22 14:21 +0200
SubjectRe: Strange syntax error, occurs only when script is executed directly [solved]
Message-ID<mailman.9436.1398169297.18130.python-list@python.org>
On 22-04-14 14:09, Chris Angelico wrote:
> 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

Yes that was it. I changed the first line of my script to:

#!/opt/local/bin/python2.7

and it now works.

Thanks.
-- 
Antoon Pardon

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web