Shebang line problems and python

Blaine brlafreniere at gmail.com
Thu Sep 17 00:35:21 EDT 2009


Chris Rebert, Rami Chowdhury:
blaine at attila ~/tmp $ which python
/usr/bin/python

Ben Finney:
blaine at attila ~/tmp $ echo $SHELL
/bin/bash
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")'

blaine at attila ~/tmp $ cat shebang-test2
#!/usr/bin/env python
import sys
sys.stdout.write("Hello, world.\n")
blaine at attila ~/tmp $ ./shebang-test2
Hello, world.

Thanks.



More information about the Python-list mailing list