Reputation: 41
I have set the Spyder 2.7 preferences as follows: Preferences->Run-> General Settings-> Default working directory is: the script directory.
However for a particular script, spyder sets the working directory to the parent directory.
I have scripts in the same directory which don't exhibit this behaviour and run with the expected wdir.
I don't understand where or how the wdir is being altered from the default for this particular script.
Upvotes: 1
Views: 2997
Reputation: 41
Under 'run' menu-> configure. This gives you an option to set the working directory for each individual script.
Upvotes: 2
Reputation: 457
I don't have the solution, but I had the exact same problem with a MATLAB script a while ago. It turned out I ran a copy of the script, and it included the path of the original, and set that as the wdir. I ran the original, it worked. If I moved the original, it didn't run because it tried running it from the previous wdir.
I ended up copying the code into a new script-file, which solved it for me. Perhaps you can try something similar.
Best of luck!
Upvotes: 0