[python-win32] permissions error

Jeff Peery jeffpeery at yahoo.com
Sat Feb 13 08:27:19 CET 2010


Ok thanks, I will look into that. 
 
I was looking around in the win32com.client.__init__.py and it appears that if I delete the folder win32com.client.gen_py then it is created dynamically in the the user/appdata/temp folder when the program launches. Which is good because the user doesn't need to be an admin for the app to write in the appdata folder. I tested this by freezing (py2exe)  my app and installed it on my computer and it lauches up and starts running ok. I checked to confirm that the gen_py file was created in the appdata folder and it was. This is good. However I tried to use the features of the app that call win32com.client.DispatchWithEvents and now it crashes with this error:
 
Exception exceptions.AttributeError: AttributeError("'<win32com.client.COMEventC
lass instance at 0x78765152>' object has no attribute '_olecp'",) in <bound meth
od COMEventClass.__del__ of <win32com.client.COMEventClass instance at 0x7876515
2>> ignored
 
It appears that the win32com client I created doesn't have the attribute '_olecp'. '_olecp' is an attribute in the script within the users/appdata/temp/gen_py folder. Why would I get this error?
 
Again with the win32com/client/gen_py folder deleted the cache (is that the correct word?) is created in the appdata/temp/gen_py folder. My UN-frozen App appears to work under this condition and uses the cached file in the appdata/temp/gen_py folder an no longer the win32/client/gen_py folder. I checked by printing a 'hello world' from this file.
 
why not the frozen app?
 
thank you in advance,
Jeff

--- On Fri, 2/12/10, Preston Landers <planders at gmail.com> wrote:


From: Preston Landers <planders at gmail.com>
Subject: Re: [python-win32] permissions error
To: "Jeff Peery" <jeffpeery at yahoo.com>
Date: Friday, February 12, 2010, 10:30 PM


I don't know if this will work but one workaround may be to set a registry key:

HKLM\\SOFTWARE\\Python\\PythonCore\\2.6\\PythonPath\\win32com

The key is GenPath and the value would be a writable location.  See win32com/__init__.py SetupEnvironment().

You could also look at pre-generating the files in question with makepy.py and including those in the executable. I don't have much experience with packaging an app into the executable format.

-Preston


On Fri, Feb 12, 2010 at 11:37 PM, Jeff Peery <jeffpeery at yahoo.com> wrote:






hi, yes I can personally do that on my computer but it is not a good solution for my users to require an administrator to grant acces every time they want to launch the software. So I will need a more permanent fix. 
 
Is it a significant task to redirect these files to the application data folder or program data folder?
 
thanks,
Jeff


--- On Fri, 2/12/10, Preston Landers <planders at gmail.com> wrote:


From: Preston Landers <planders at gmail.com>

Subject: Re: [python-win32] permissions error
To: "Jeff Peery" <jeffpeery at yahoo.com>
Date: Friday, February 12, 2010, 7:24 PM





Have you tried manually granting a write permission for your user to that directory?  
-Preston


On Fri, Feb 12, 2010 at 9:08 PM, Jeff Peery <jeffpeery at yahoo.com> wrote:






hello,
yes, I am using 64 bit vista. and I am using py2exe to distribute my app. At the moment I'm dead in the water unti lI resolve this issue. Does anyone know of a quick fix?
 
thanks,
Jeff

--- On Fri, 2/12/10, Tim Roberts <timr at probo.com> wrote:


From: Tim Roberts <timr at probo.com>
Subject: Re: [python-win32] permissions error
To: "Python-Win32 List" <python-win32 at python.org>
Date: Friday, February 12, 2010, 10:37 AM 





Dave Angel wrote:
> 2) Are you running a 64bit version of Vista?

Yes, he is.  The path "Program Files (x86)" is prima facie evidence of
this.  He's running 32-bit Python on a 64-bit system.  And that's just fine.


> 3) What do you mean by "compile" and "compiled executable"?

It means he has used something like "py2exe" to turn his Python code
into an executable.

This is a real problem, and one that pywin32 probably needs to address. 
On Vista and beyond, the "Program Files" directories are not writable by
non-elevated programs.  The win32com-generated wrappers need to go
somewhere else, like "Local Settings\Temp" or "Local Settings\Apps".

-- 
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.

_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32


_______________________________________________
python-win32 mailing list
python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32







      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20100212/92db6a9b/attachment-0001.htm>


More information about the python-win32 mailing list