When you run a script from the editor, it's essentially the same as starting a Bash console, using cd
to navigate to the directory where the script is stored, and then running pythonX.Y scriptname.py
(we have some extra logic to guess what version of Python you're using so as to work out what to put in place of the X.Y).
A scheduled or always-on task, by contrast, is actually a Bash command. So you don't have to schedule a Python script, you could (if you liked) schedule a Bash command like "ls" or "echo hello". That means that in the general case we don't know what directory you would like to "cd" to before running it, so we default to using your home directory. We could perhaps have some special-case code so that if the thing that you schedule is just a path to a Python script, we "cd" to it before running it, but that could lead to confusion -- for example, it would mean that scheduling this:
/home/yourusername/something/yourscript.py
...would use Python to run yourscript.py
having first used cd
to change directory to /home/yourusername/something/
, but scheduling this:
python3.7 /home/yourusername/something/yourscript.py
...would have to run in /home/yourusername/
, which would be even more confusing than the current situation!