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