Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing data files into %APPDATA% with distutils on Windows 7 X64

My setup routine using distutils that works perfectly fine on Windows XP does not work for Windows 7. Here are the specifics:

My package has a lot of config files which I install into %APPDATA%. On Windows I run setup.py with the bdist_wininst option to create an installer. On Win7 the installer is then executed as Administrator so that the module can be installed into %PROGRAMFILES%\Python etc. The installation does not report any errors but as you might have guessed the config files will not have been installed into %APPDATA% nor anywhere else (I searched for them).

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

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

like image 447
ifschleife Avatar asked May 07 '12 14:05

ifschleife


People also ask

What does Distutils mean in Python?

The distutils package provides support for building and installing additional modules into a Python installation. The new modules may be either 100%-pure Python, or may be extension modules written in C, or may be collections of Python packages which include modules coded in both Python and C.

Where should I install Python?

By default the Python installer for Windows places its executables in the user's AppData directory, so that it doesn't require administrative permissions. If you're the only user on the system, you might want to place Python in a higher-level directory (e.g. C:\Python3. 7 ) to make it easier to find.


1 Answers

You may use something like the common solution on *nix. Install the config files to %PROGRAMFILES%, and copy them to %APPDATA% when the program detects a particular user is running the program for the first time (which can be detected by checking that the config files are missing).

like image 171
Apalala Avatar answered Sep 19 '22 00:09

Apalala