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 <
ste...@remove.this.cybersource.com.au> wrote:

> On Wed, 16 Sep 2009 21:35:21 -0700, Blaine wrote:
>
> > bla...@attila ~/tmp $ cat ./shebang-test
> > #!/usr/bin/python
> > import sys
> > sys.stdout.write("Hello, world.\n")
> > bla...@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
>
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to