Is there a way in a Python script to determine if the caller provided the interpreter on the command line or if the shebang line was used to determine the interpreter to use?
As a simple example, myscript.py (which has executable permissions):
#!/bin/env python import sys print sys.argv
I want to know if this script was called like:
$ python myscript.py
sys.argv is just "myscript.py" in either case.