Shebang line problems and python
srikrishnamohan at gmail.com
Thu Sep 17 07:07:48 CEST 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
simply run the python script as "python myscript.py" at the shell prompt
(note that this doesnt need shebang line in ur script file)
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
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list