[python-win32] permissions error

Mark Hammond skippy.hammond at gmail.com
Sun Feb 14 04:31:34 CET 2010


On 12/02/2010 4:32 PM, Jeff Peery wrote:
> Hello,
> I'm running on vista and I'm getting a permissions error from win32com.
> I attached a print screen displaying the error message. It appears
> win32com is trying to write a file and vista UAC is blocking it. Why is
> win32com trying to do this and how do I fix it? the only method I am
> using from win32com is "win32com.client.DispatchWithEvents()" to create
> a client of a windows OPC server. It works fine until I compile it and
> run it from the compiled executable and this message appears.
> thanks,
> Jeff

There are 2 general solutions to this:

* Follow the instructions at 
http://www.py2exe.org/index.cgi/IncludingTypelibs to allow py2exe to 
include the pre-generated version of the makepy files you need at 
runtime.  This saves work on each installed PC, and also avoids needing 
to have the typelibs included on each target PC (the usually will be 
available, but depending on a number of things, may not be)

* Tell py2exe to avoid including anything in the win32com\gen_py folder. 
  If no such folder exists as win32com initializes, it will use a folder 
under %TEMP% for this purpose - but if it does exist - even inside a 
read-only .zip file or in a read-only directory - it blindly tries to 
use it.  As you are seeing, this will fail for stuff installed under 
"Program Files" - you need elevated permissions to write there.

The first is the best general option - you don't have to rely on writing 
anything anywhere to achieve something which works (but it isn't clear 
you are using py2exe - so while that specific advice may not be 
applicable, the general idea is (ie, ship with a pre-populated 
win32com\gen_py folder)

HTH,

Mark


More information about the python-win32 mailing list