Closed Bengt closed 10 years ago
I'll take a look at this. I know #5 references virtualenv at one point. I use rbenv
myself for Ruby and run from the command line which means I never see the conflicting paths though. Python is an interesting use case (the name of the executable that is).
Notice that "Blanks after !
are OK.", so these variants should work, too:
#! /usr/bin/env python
#! /bin/python
Additionally, command line flags might be given to the interpreter: Some interesting cases are these:
#!/bin/python --version
#!/bin/python --
#!/bin/python -
#!/bin/python -3
#!/bin/python -c
#!/bin/python -O
#!/bin/python -OO
#!/bin/python -Q new
Also there are multiline shebangs. To start python from a polyglot bash/python file:
#!/bin/bash
"exec" "python" "$0"
print "Hello World"
I vote the very last one just gets handled by the bash handler. Why would anyone use that one?
@rgbkrk polyglot files can exploit features of both programming languages. For example bash knows $0
to be the filename, while the embedded language might not. This example is the not really useful but demonstrates the how to do this in bash/python. Python has in fact access to the filename sys.args[0]
, but other scripting languages do not. Perhaps there is something bash has access to and Python does not, but I do not know about such a thing. In any case, I think executing the file as a bash script should work just fine without action from atom-script's side.
atom-script always starts my Python scripts with the default python, even if i declare a shebang.
and
yield
Notice that it is common for python scripts to be only compatible with one major version, so a (global) configuration would not solve the issue.