Sorry, the code is rather:
pythonEngine->AddTypeLib( theLibGUID, dwLibMajorVersion, dwLibMinorVersion, 
SCRIPTTYPELIB_ISCONTROL );

-mab
 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Marc-André 
Belzile
Sent: May 30, 2007 11:19 AM
To: Mark Hammond; python-win32@python.org
Subject: Re: [python-win32] Win32 COM cache problem

That's odd, if I copy the tlb in the current folder then the __init__.py is not 
recreated:

10:33:14 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\__init__.py       SUCCESS 
Attributes: A   
10:33:14 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.py
     NOT FOUND       Attributes: Error       
10:33:14 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.pyc
    NOT FOUND       Attributes: Error       
>>> 10:33:14 AM XSI.exe:3896    QUERY INFORMATION       
>>> C:\Softimage\XSI_6.02_Debug-0528\Application\si3dobjectmodel.tlb        
>>> SUCCESS Attributes: A   

Otherwise, multiple write access calls are performed on __init__.py:

10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\__init__.py       SUCCESS 
Attributes: A   
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.py
     NOT FOUND       Attributes: Error       
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.pyc
    NOT FOUND       Attributes: Error       
>>> 10:11:50 AM XSI.exe:3896    QUERY INFORMATION       
>>> C:\Softimage\XSI_6.02_Debug-0528\Application\si3dobjectmodel.tlb        NOT 
>>> FOUND       Attributes: Error       
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
Attributes: N   
10:11:50 AM     XSI.exe:3896    OPEN    
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
Options: Open  Access: Read     
10:11:50 AM     XSI.exe:3896    OPEN    
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
Options: Open  Access: 00100080 
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
FileInternalInformation 
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
Length: 479208  
10:11:50 AM     XSI.exe:3896    READ    
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
Offset: 0 Length: 64    
10:11:50 AM     XSI.exe:3896    CLOSE   
C:\Softimage\XSI_6.02_Debug-0528\Application\bin\si3dobjectmodel.tlb    SUCCESS 
        
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\__init__.py       SUCCESS 
Attributes: A   
10:11:50 AM     XSI.exe:3896    OPEN    
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.py
     NOT FOUND       Options: Open  Access: 00010080 
10:11:50 AM     XSI.exe:3896    OPEN    
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.pyc
    NOT FOUND       Options: Open  Access: 00010080 
10:11:50 AM     XSI.exe:3896    OPEN    
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0.pyo
    NOT FOUND       Options: Open  Access: 00010080 
10:11:50 AM     XSI.exe:3896    CREATE  
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Options: OverwriteIf  Access: 00120196  
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS FileFsVolumeInformation 
10:11:50 AM     XSI.exe:3896    QUERY INFORMATION       
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    BUFFER OVERFLOW FileAllInformation      
>>>
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 0 Length: 1024  
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 1024 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 2048 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 3072 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 4096 Length: 72 
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 4168 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 5192 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 6216 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 7240 Length: 1024       
10:11:51 AM     XSI.exe:3896    WRITE   
C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11D3-811D-00A0C9AC19A9x0x1x0\__init__.py
    SUCCESS Offset: 8264 Length: 56 
... and the list goes on

The write access calls occur when typelibs are added to the scripting ActiveX :

pythonEngine->AddTypeLib( theLibGUID, dwLibMajorVersion, 
pythonEngine->dwLibMinorVersion, SCRIPTTYPELIB_ISCONTROL );

-mab

-----Original Message-----
From: Mark Hammond [mailto:[EMAIL PROTECTED]
Sent: May 29, 2007 10:24 PM
To: Marc-André Belzile; python-win32@python.org
Subject: RE: [python-win32] Win32 COM cache problem

> 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.

This should not be the case, and there should be no assumption about the 
location of the typelib - indeed, we generally just ask COM to load it for us.  
I'm afraid I have no insights to the problems you face, so you might need to 
dig a little more to see what is going wrong, or work out a way so I can 
reproduce the problem locally.

Cheers,

Mark

> 
> Am I doing something wrong ? Thanks in advance...
> 
> -mab
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] 
> [mailto:[EMAIL PROTECTED] On Behalf Of Marc-André 
> Belzile
> Sent: May 28, 2007 6:28 PM
> To: python-win32@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-11
> D3-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-11
> D3-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-11
> D3-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-11
> D3-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-11
> D3-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-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py BUFFER OVERFLOW 
> FileAllInformation
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 0 Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 1024
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 2048
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 3072
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 4096 Length: 72
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 4168
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 5192
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 6216
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 7240
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 8264 Length: 56
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 8320
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 9344
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 10368
> Length: 1024
> 5:47:28 PM XSI.exe:4964 WRITE
> C:\Python25\lib\site-packages\win32com\gen_py\269C4D8C-E32D-11
> D3-811D-00A0C9AC19A9x0x1x0\__init__.py SUCCESS Offset: 11392
> Length: 1024 etc...
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
> 
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to