[python-win32] EOFError in gencache.py
Paul Hudson
phudson1442 at gmail.com
Tue Jul 21 20:28:07 CEST 2009
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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20090721/0e762693/attachment.htm>
More information about the python-win32
mailing list