Where is a good place / way to store Windows configuration files for Python scripts?

I have a script / program that I'm working on, it requires a configuration file (I use ConfigParser ). In linux, by default I save these variables to ~/.myscript using the os.getenv('HOME') function.

On Windows, I know that I can use os.getenv('USERPROFILE') to search for the user's home directory, however, is it a good idea to save the hidden file this way (i.e. with the name .myscript )?

I am not using Windows, obviously, but wanted to be smart about it for those who do it.

Is there a standard place / way to store these configuration variables on Windows?

+4
source share
1 answer
 os.environ['AppData'] 

Usually a folder is created inside with the name of your organization and any files are placed in it. No need to "hide files" as well . at the beginning of the file name is not valid on Windows.

Or put the settings in the registry .

+2
source

Source: https://habr.com/ru/post/1310602/


All Articles