Based on R, using setwd to change a directory is great, but not against reproducibility, because others do not have the same directory structure as mine. Therefore, it is recommended that you use the relative path from the location of the script.
IDEs complicate this a bit because they install their own working directory. In Rstudio, I can easily get around this problem with Rstudio projects by setting the project directory to the script folder.
With Python and Spyder there is no solution. Spyder does not have a feature like the Rstudio project. Setting the directory to the script folder does not work during interactive analysis (since __file__ not available).
What to do to make the working directory in Python / Spyder play?
source share