[Distutils] windows overlay files

Steve Dower Steve.Dower at microsoft.com
Wed Nov 12 18:49:31 CET 2014


Robin Becker wrote:
> Hi,
> I hope some windows expert can assist me with a production problem. We support a
> user using windows who reports problems concerning missing attributes. Using
> GotoMeeting we inspected the file together and see that the attribute should be
> present. I asked them to zip up the reportlab folder from site-packages and the
> module that is in the zip does not have the attribute. Puzzlement!

Is this site-packages folder in a normal Python install in x:\Python##? Or has it been installed elsewhere?

> Searching reveals this
> 
>> Due to security features introduced with Windows Vista (UAC) any
>> non-Administrator program that tries to write to protected locations
>> such as "Program Files" will get their writes caught and redirected to
>> an alternative "user friendly" location.
>>
>> The program that made the file will be able to see the file, but most
>> other programs will not.
>>
>> Files written to "protected locations" will end up in a parallel file
>> structure under C:\Users\[username]\AppData\Local\VirtualStore, but
>> will appear to the program that created them as if actually in the
>> intended location.
> 
> 
> so I'm wondering if this is such an issue. The user has a 4 year old version of
> reportlab and doesn't wish to upgrade. In the past, when they had XP, we used to
> support minor fixes by modifying the modules and having them overwrite the
> installed versions in site-packages files.

How does the overwrite work? If they are copying files in Explorer, the redirection you quote above should not occur, but if you have a separate program to do the copying then it will if the program is not run as administrator.

> Clearly if some kind of security issues are in place which causes this kind of
> double file problem, then overwriting the python will not always work. In
> addition it may be that users can't write the pyc or something.

The pyc issue should be resolved by generating them at install time. There's an option in the Python installer for this, but any packages added later will need to do it themselves (I believe all of the standard installers do it - pip/easy_install/bdist_win).

> Does anyone here have experience of these issues? Will I be forced to maintain
> patched installers etc etc? Is there some trick like having an administrator
> write the files?

If the files need to be written into Program Files, then you'll need to be an administrator - you're making a machine-wide change, which regular users don't have permission to do.

That's about all the info I can provide without more details about the customer's file system layout (full paths are really necessary for figuring this out) and the programs/processing being used to install and update these files.

Cheers,
Steve

> --
> Robin Becker
>


More information about the Distutils-SIG mailing list