Change Working Directory in Spyder

Change Working Directory in Spyder
Change Working Directory in Spyder

Problem:

When you are running a script, it tense to switch working directory(wdir) away from the global working directory.

Solution:

The issue turned out to be the run settings, which can be accessed from either:

Ctrl + Alt + Shift + P

or

Tools -> Run -> General Settings -> Default Working Directory

This was still set to the old_user home directory, and not the new user. I don’t know why this didn’t affect other scripts (or why it was still set to the old user) but, when this was changed to new_user, it worked fine and ran with the correct wdir.

Source: Stackoverflow