Python: simple example trying to create a unix command-line executable - why won't it work? Python: simple example trying to create a unix command-line executable - why won't it work? unix unix

Python: simple example trying to create a unix command-line executable - why won't it work?


Get rid of the spaces in #! /usr/local/bin/ python so it's #!/usr/local/bin/python. You may also want to make it #!/usr/bin/env python, which will select the first Python interpreter in your path, but that's not recommended for published modules. (Although, neither is /usr/local/bin/python).


Your shebang has too many spaces. Try

#!/usr/local/bin/python

Another common form calls 'env' to find which python to use so that you are not dependent on paths that tend to be different depending on how python was installed.

#!/usr/bin/env python


You have space between /bin/ and python.

HTH, Phil