Install data files in% APPDATA% with distutils on Windows 7 X64

My setup using distutils, which works fine on Windows XP, doesn't work on Windows 7. Here are some features:

There are many configuration files in my package that I install in% APPDATA%. On Windows, I run setup.py with the bdist_wininst option to create an installer. In Win7, the installation program is then run as Administrator so that the module can be installed in% PROGRAMFILES% \ Python, etc. The installation does not report any errors, but, as you might have guessed, the configuration files will not be installed in% APPDATA% and nowhere (I searched for them).

If I open cmd as Administrator and install my package with the installation option directly (setup.py install), everything works fine, however.

So what am I missing here? Is this a limitation in the graphical installer, or am I doing something wrong?

+6
source share
1 answer

You can use something like a generic solution on * nix. Set the configuration files to %PROGRAMFILES% and copy them to %APPDATA% when the program detects that a particular user is launching the program for the first time (which can be detected if you check that the configuration files are missing).

+1
source

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


All Articles