I am working on an environment where I have to call my python script by itself : ./myscript.py instead of python-2.4 -m trace -t /myscript.py.
So , I try to add arguments in the shebang like below :
#!/usr/bin/python-2.4 -m trace -t
print "HELLO"
print "HW"
But I got the error message below :
/usr/bin/python-2.4: module trace -t not found
Is it possible in Python ? I don't want to handle this trace module inside my script.
It isn't possible to do this simply on most platforms, particularly Linux. The POSIX standard only requires that a single command line option be supported by the shebang. This can mean that the arguments are truncated, but it can also lead to all of the options being passed as a single option, as though they were contained in quotation marks.
The simplest way to achieve this is to create an additional wrapper. For example: