"Antoon Pardon" <antoon.par...@rece.vub.ac.be> wrote in message news:535644a4.6060...@rece.vub.ac.be... >I am workin on a solaris 11 machine. The python version is 2.7.6 > path to python is /opt/local/bin/python. > [...] > > Now if I execute the script by explicitly calling the interpreter > everything works fine. > [...] > > 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):' >
I had something similar and it turned out that my script had 'CRLF' line endings instead of 'LF' only, and this caused the problem. I believe that the problem has nothing to do with python, but with how the shell interprets the '#!' line. My editor allows me to re-save a file using a different format, so I saved it as 'unix', reran it, and it worked. HTH Frank Millman -- https://mail.python.org/mailman/listinfo/python-list