I have a directory which I would like to be the default for Python scripts so when a user is running python foo.py arg1 arg2 and foo.py is not in the current directory, it should execute python /defaultdir/foo.py arg1 arg2. Neither $PATH nor $PYTHONPATH is good for that: the first would only work with the command foo.py arg1 arg2, which requires a hashbang in the script and execution rights, while the second only works for import˙commands from an already running script. I suppose I could replace the Python binary with a wrapper, but I would prefer a cleaner solution if there was one.
I have a directory which I would like to be the default for Python
Share
Use python -m: