Hi, I have a similar problem as described bellow - launching multiple instances of my application causes rewriting dicts.dat file in gen_py cache, sometimes when two processes running at the same time it leads to errors, because of locked dicts.dat. Is there some way to prevent this file to rewrite at every EnsureDispatch()? I tried to set it readonly -> <type 'exceptions.IOError'>: [Errno 13] Permission denied: 'C:\\Python26\\lib\\site-packages\\win32com\\gen_py\\dicts.dat' args = (13, 'Permission denied') errno = 13 filename = r'C:\Python26\lib\site-packages\win32com\gen_py\dicts.dat' message = '' strerror = 'Permission denied'
(I am launching the script from cgi environment) Thanks for any help Peter On Tue, Jul 21, 2009 at 8:28 PM, Paul Hudson <phudson1...@gmail.com> wrote: > Hi, > > I am having a similar problem when launching multiple instances of an > Application that allows Python scripting via COM. (Yes, I am launching > these instances at the same time.) > > The error I get is: > > File "C:\Python26\Lib\site-packages\win32com\client\makepy.py", line 288, > in GenerateFromTypeLibSpec > os.rename(outputName + ".temp", outputName) > <type 'exceptions.WindowsError'>: [Error 32] The process cannot access the > file because it is being used by another process > pythoncom error: Unexpected exception in gateway method 'AddTypeLib' > > As stated below, I understand the gen_py folder is not thread-safe. The > behavior I am seeing suggests many of the __init__.py files are being > rewritten every time an instance of my App initiates Python. Is this normal > win32com.client implementation? If I am using the same App day after day, > do the gen_py folders and files need rewritten constantly? Is there a way > to tuck away the gen_py files for this App into a more permanent location? > > > Thanks, > Paul > >> >> ---------------Original Message---------------------- >> >> On 5/02/2009 9:40 AM, Zdenek Mejzlik wrote: >> > File "c:\python25\lib\site-packages\win32com\client\gencache.py", line >> > 109, in _LoadDicts >> > version = p.load() >> > EOFError >> >> >> This is an error loading 'dicts.dat' from the win32com\gen_py directory. >> The management of this file is very crude and doesn't protect against >> threads or processes stomping on other. >> >> Does you app create COM objects on different threads, or are there >> >> multiple instances of your app starting at the same time? If so, we >> might like to instrument the code to see if this indeed the problem. >> >> > If I uninstall both pywin and Python and install them again the problem >> >> > disappears. But it is only temporary >> > solution the problem returns back after several days. Please, help me to >> > find the definitive solution. >> >> A quicker workaround should be to remove dicts.dat, or indeed, the >> >> contents of the entire gen_py directory (but don't remove the directory >> itself, or makepy will assume it can't write to win32com and use a >> gen_py under %TEMP%.) >> >> Cheers, >> >> Mark > > _______________________________________________ > 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