Set working directory in Python / Spyder so that it's reproducible
To do this automatically, put this at the beginning of your script:
from os import chdir, getcwdwd=getcwd()chdir(wd)
In the interim, you can use os.chdir
import osos.chdir('C:\Users\me\Documents')
It appears they did consider this as a feature in Spyder based on this GitHub ticket, but it is still waiting implementation as of mid-May:
We could add an option to the Run dialog to automatically set the working directory to the one your script is being ran.
However, someone else will have to implement it. We're pretty busy with other things at the moment, sorry.
https://github.com/spyder-ide/spyder/issues/3154
@ccordoba12 ccordoba12 added this to the wishlist milestone on May 14