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

2014-04-22 Thread Antoon Pardon
On 22-04-14 14:09, Chris Angelico wrote:
 On Tue, Apr 22, 2014 at 8:29 PM, Antoon Pardon
 antoon.par...@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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-04-22 Thread Chris Angelico
On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon
antoon.par...@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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-04-22 Thread Antoon Pardon
On 22-04-14 14:26, Chris Angelico wrote:

 On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon
 antoon.par...@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.

-- 
Antoon Pardon


-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-04-22 Thread Chris Angelico
On Tue, Apr 22, 2014 at 11:01 PM, Antoon Pardon
antoon.par...@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.par...@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
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-04-22 Thread Andrew Cooper
On 22/04/2q014 13:26, Chris Angelico wrote:
 On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon
 antoon.par...@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
 

`man execve`

The interpreter must be a valid pathname for an executable which is not
itself a script.

This is (presumably) to avoid recursive walks of the filesystem trying
to locate a valid interpreter to splat over the virtual address space of
the currently executing process.

~Andrew
-- 
https://mail.python.org/mailman/listinfo/python-list


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

2014-04-22 Thread Andrew Cooper
On 22/04/2q014 13:26, Chris Angelico wrote:
 On Tue, Apr 22, 2014 at 10:21 PM, Antoon Pardon
 antoon.par...@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
 

`man execve`

The interpreter must be a valid pathname for an executable which is not
itself a script.

This is (presumably) to avoid recursive walks of the filesystem trying
to locate a valid interpreter to splat over the virtual address space of
the currently executing process.

~Andrew
-- 
https://mail.python.org/mailman/listinfo/python-list