Shebang line problems and python
km
srikrishnamohan at gmail.com
Thu Sep 17 01:07:48 EDT 2009
assuming that ur on linux/unix
and assuming that u have shebang line as #!/usr/bin/python in ur script
set permissions like this
chmod 755 myscript.py
and then run the script as ./myscripy.py
OR
simply run the python script as "python myscript.py" at the shell prompt
(note that this doesnt need shebang line in ur script file)
HTH,
Krishna
On Thu, Sep 17, 2009 at 1:46 PM, Steven D'Aprano <
steven at remove.this.cybersource.com.au> wrote:
> On Wed, 16 Sep 2009 21:35:21 -0700, Blaine wrote:
>
> > blaine at attila ~/tmp $ cat ./shebang-test
> > #!/usr/bin/python
> > import sys
> > sys.stdout.write("Hello, world.\n")
> > blaine at attila ~/tmp $ ./shebang-test
> > ./shebang-test: line 2: import: command not found ./shebang-test: line
> > 3: syntax error near unexpected token `"Hello, world.\n"'
> > ./shebang-test: line 3: `sys.stdout.write("Hello, world.\n")'
>
>
> I've seen something similar to this, which was caused by invisible ctrl-Z
> characters somehow getting into my text file. If you view a hexdump of
> the file, are there any unexpected characters in the file, particularly
> before or between the # ! characters?
>
> If not, what happens if you run the file directly with Python?
>
> python shebang-test
>
>
>
> --
> Steven
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090917/92596dea/attachment-0001.html>
More information about the Python-list
mailing list