Whenever I execute a script by clicking on it in a file manager window it gets run with my home directory as it's working directory, not directory that has the script within it where I'm clicking.
This is a pain if the code needs to access files in the actual directory where the script is located.
Is there a way to change this behavior?
foo.py is located in the folder
foo.data is also located there and is read by
foo.py during execution.
If I open a terminal in that folder and run the script, it runs with
/home/phil/src/python as it's working directory and it successfully finds and opens
However, if I open my file manager (pcman in my case, Lubuntu), navigate to
/home/phil/src/python and double click
foo.py to run it it will run with
/home/phil as it's working directory. It won't find
foo.data and it will fail.
After googling this a bit it seems this also happens with Nautilus.