[Tutor] env shebang with options

Thorsten Kampe thorsten at thorstenkampe.de
Thu Apr 29 19:13:12 EDT 2004


I'm trying to set up a Python script with a shebang with options:

% cat test.py
#! /usr/bin/env python -Ot

print 11

% chmod 700 test.py; ./test.py
/usr/bin/env: python -Ot: No such file or directory

% env --version
env (coreutils) 5.0.91

According to Alex Martelli in "Python in a Nutshell" this should work: 

"On Unix-like systems, you can make a Python script directly
executable by setting the file's permission bits /x/ and /r/ and
beginning the script with a so called /shebang/ line, which is a first
line of the form:
#!/usr/bin/env python {options}
providing a path to the /python/ program."

I've already tried all variations of the shebang I can think of. None
work except the trivial "#! /usr/bin/python -Ot".

% env --help
Usage: env [OPTION]... [-] [NAME=VALUE]... [COMMAND [ARG]...]

So it /should/ work... Why not?


Thorsten




More information about the Tutor mailing list