Oct-15-2019, 07:33 PM
when you are in your IDE, the Current Working Directory is not always your source directory.
Thus when you save a file it may be saved in another directory (the CWD).
you can assure that you are in your source directory by importing os, then adding the following code
after all of your current code (bottom of script), replacing mycode with actual class of function name.
This will assure file will be saved in source directory when run from IDE.
Thus when you save a file it may be saved in another directory (the CWD).
you can assure that you are in your source directory by importing os, then adding the following code
after all of your current code (bottom of script), replacing mycode with actual class of function name.
This will assure file will be saved in source directory when run from IDE.
if __name__ == '__main__': import os os.chdir(os.path.abspath(os.path.dirname(__file__))) mycode()