From: MHammond at skippinet.com.au (Mark Hammond)
Date: Tue, 25 May 1999 09:47:30 +1000
Subject: Module initialization problem when using COM
References: <0E16861EE7BCD111BE9400805FE6841F0949A5B2@c1s5x001.cor.srvfarm.origin-it.com>	<7i4sgb$3c5$1@m2.c2.telstra-mm.net.au> <0E16861EE7BCD111BE9400805FE6841F09581422@c1s5x001.cor.srvfarm.origin-it.com> <37495899.62DA32ED@appliedbiometrics.com>
Message-ID: <7icobr$9o$1@m2.c2.telstra-mm.net.au>
Content-Length: 1457
X-UID: 1745                                                

[From comp.lang.python; cc to the PythonCOM developers mailing list]
Christian Tismer wrote in message
<37495899.62DA32ED at appliedbiometrics.com>...

>Without having tried, here my guess: (may be very wrong)

Also without trying, here is my guess, which is very close to yours.

When Python is hosting a COM object, it tries to be a good citizen by
cleaning up.  When the last PythonCOM object destructs, Python is finalized.
When the first PythonCOM object is created, Python is initialized.

This means that the process of creating one COM object, freeing it, then
creating another is transitioning between these states.  As Python has been
finalized and reinitialized, the imports are indeed happening again, as you
would expect in this scenario.

It is unclear if this behaviour of PythonCOM is desirable; if it is not, I
cant see a better way to determine that Python should be finalized - so we
could simply _never_ finalize Python.  However, this is not nice for a long
running process (eg, IIS) that happens to use a Python COM object once.
Ideally (but probably not realistically) finalizing Python should remove
_all_ traces that it ever existed (ie, every scrap of memory should be
freed)

Either way, it does appear that this is the underlying ILU problem.  I would
guess we could invoke the same behaviour from a test program that init'd
then finalized then re-init'd Python before again using ILU.  Is this
possible to confirm?

Mark.







