Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #70499
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python-python-list@m.gmane.org> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'python,': 0.02; 'subject:error': 0.03; 'syntax': 0.04; 'explicitly': 0.05; 'interpreter': 0.05; 'only,': 0.07; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:script': 0.09; 'worked.': 0.09; 'python': 0.11; 'wrote': 0.14; 'fine.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:when': 0.16; 'unexpected': 0.16; 'shell': 0.22; 'error': 0.23; 'format,': 0.24; 'script': 0.25; 'header:X-Complaints-To:1': 0.27; 'allows': 0.31; 'file': 0.32; 'problem': 0.35; 'problem.': 0.35; 'something': 0.35; 'editor': 0.35; 'but': 0.35; 'version': 0.36; 'machine.': 0.36; 'similar': 0.36; 'error.': 0.37; 'to:addr :python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'how': 0.40; 'different': 0.65; 'believe': 0.68; 'frank': 0.68; 'caused': 0.69 |
| X-Injected-Via-Gmane | http://gmane.org/ |
| To | python-list@python.org |
| From | "Frank Millman" <frank@chagford.com> |
| Subject | Re: Strange syntax error, occurs only when script is executed directly |
| Date | Tue, 22 Apr 2014 12:42:27 +0200 |
| References | <535644A4.6060901@rece.vub.ac.be> |
| X-Gmane-NNTP-Posting-Host | 197.87.184.119 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.3790.4657 |
| X-RFC2646 | Format=Flowed; Original |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.3790.4913 |
| 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.9433.1398163357.18130.python-list@python.org> (permalink) |
| Lines | 35 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1398163357 news.xs4all.nl 2886 [2001:888:2000:d::a6]:59425 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:70499 |
Show key headers only | View raw
"Antoon Pardon" <antoon.pardon@rece.vub.ac.be> wrote in message
news:535644A4.6060901@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
Back to comp.lang.python | Previous | Next | Find similar | Unroll thread
Re: Strange syntax error, occurs only when script is executed directly "Frank Millman" <frank@chagford.com> - 2014-04-22 12:42 +0200
csiph-web