[python-win32] Win32 COM cache problem
Marc-André Belzile
mbelzile at softimage.com
Wed May 30 19:44:42 CEST 2007
The buffer overflow occurs after the __init__file.py has been re-created:
1:40:02 PM XSI.exe:3836 QUERY INFORMATION C:\Python25\lib\site-packages\win32com\gen_py\__init__.py SUCCESS Attributes: A
1:40:02 PM XSI.exe:3836 OPEN C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.py NOT FOUND Options: Open Access: 00010080
1:40:02 PM XSI.exe:3836 OPEN C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.pyc NOT FOUND Options: Open Access: 00010080
1:40:02 PM XSI.exe:3836 OPEN C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.pyo NOT FOUND Options: Open Access: 00010080
1:40:02 PM XSI.exe:3836 CREATE C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Options: OverwriteIf Access: 00120196
1:40:02 PM XSI.exe:3836 QUERY INFORMATION C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS FileFsVolumeInformation
1:40:02 PM XSI.exe:3836 QUERY INFORMATION C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py BUFFER OVERFLOW FileAllInformation
1:40:03 PM XSI.exe:3836 WRITE C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 0 Length: 1024
1:40:03 PM XSI.exe:3836 WRITE C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 1024 Length: 1024
1:40:03 PM XSI.exe:3836 WRITE C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 2048 Length: 1024
For some reasons, pywin recreates it if 269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.py doesn't exist. This also happens for other typelibs added to the python engine.
-mab
-----Original Message-----
From: python-win32-bounces at python.org [mailto:python-win32-bounces at python.org] On Behalf Of Thomas Heller
Sent: May 30, 2007 12:08 PM
To: python-win32 at python.org
Subject: Re: [python-win32] Win32 COM cache problem
Marc-André Belzile schrieb:
> I dig a bit more and it appears that the python win32 com module requires all target typelibs to be in the app current directory. Otherwise the cache is systematically re-generated anytime a new scripting engine is created.
>
> Am I doing something wrong ? Thanks in advance...
>
> -mab
>
> -----Original Message-----
> From: python-win32-bounces at python.org
> [mailto:python-win32-bounces at python.org] On Behalf Of Marc-André
> Belzile
> Sent: May 28, 2007 6:28 PM
> To: python-win32 at python.org
> Subject: [python-win32] Win32 COM cache problem
>
> Hi,
>
> My win32 app is hosting python 2.5 via the scripting ActiveX object. Everything works perfectly but the win32 COM cache behaves strangely if the app current folder (e.g. c:\temp) is different than the application path (e.g. c:\bin\MyApp). At some point when the app needs to create a new python scripting engine, the whole cache gets re-created from scratch which makes things pretty slow. This will not happen if the app is executed from it's normal application folder.
>
> Is there anything I can do to avoid this problem other than running the app from its normal application folder ?
>
> Below is an excerpt of a filemon log that shows the cache generation.
>
> Thanks for your help.
>
> -mab
>
> 5:47:26 PM XSI.exe:4964 OPEN
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-
> 00A0C9AC19A9x0x1x0.py NOT FOUND Options: Open Access: 00010080
> 5:47:26 PM XSI.exe:4964 OPEN
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-
> 00A0C9AC19A9x0x1x0.pyc NOT FOUND Options: Open Access: 00010080
> 5:47:26 PM XSI.exe:4964 OPEN
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-
> 00A0C9AC19A9x0x1x0.pyo NOT FOUND Options: Open Access: 00010080
> 5:47:26 PM XSI.exe:4964 CREATE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-
> 00A0C9AC19A9x0x1x0\__init__.py SUCCESS Options: OverwriteIf Access:
> 00120196
> 5:47:26 PM XSI.exe:4964 QUERY INFORMATION
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-
> 00A0C9AC19A9x0x1x0\__init__.py SUCCESS FileFsVolumeInformation
> 5:47:26 PM XSI.exe:4964 QUERY INFORMATION
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-
> 00A0C9AC19A9x0x1x0\__init__.py BUFFER OVERFLOW FileAllInformation
^^^^^^^^^^^^^^^ Have you investigated why the above call fails? To me this looks like pywin cannot determine something about the file, and then recreates it just in case...
Thomas
_______________________________________________
Python-win32 mailing list
Python-win32 at python.org
http://mail.python.org/mailman/listinfo/python-win32
More information about the Python-win32
mailing list