Module initialization problem when using COM

Robin Boerdijk robin.boerdijk at nl.origin-it.com
Mon May 24 08:00:24 EDT 1999


Mark Hammond <MHammond at skippinet.com.au> wrote in message
news:7i4sgb$3c5$1 at m2.c2.telstra-mm.net.au...
>
> Robin Boerdijk wrote in message
>
<0E16861EE7BCD111BE9400805FE6841F0949A5B2 at c1s5x001.cor.srvfarm.origin-it.com
> >...
> >We have the following problem: The initialization function of the ILU
> >extension module gets called more than once when used within a Python COM
> >server and called from Visual Basic (and this makes ILU crash).
> >

<snip>

> Well, I would have to say it is a PythonCOM problem somehow.  This is
> clearly voilating how Python says imports will work.  But for the life of
me
> I cant see why this is happening without running the code.  Fortunately
you
> provided a nice set of test code - thanks!  Unfortunately, I dont have
time
> at the moment - but I will try and sort this before I release my next
build.

Apperently, this behaviour has not been reported before. Let me explain a
little bit more about what happened when we worked around this problem as
this may provide more insight into where the cause of the problem is.

We moved the CreateObject() from the Command1_Click handler to the Form_Load
function to prevent CreateObject to be invoked mulitple times. As expected,
the problem now disappeared, at least for a single run of the VB program
within the VB development environment. But when we executed the program
twice within the VB development environment, the problem reappeared.
Apperently, VB doesn't clean things up as I would have expected and this
somehow leads to the module initialization function being re-invoked.

When we then built the program into a stand-alone executable, everything
went OK. (Unfortunately, we want to be able to debug things so we need the
program to run properly within the VB development environment as well)

I hope this helps,

Robin










More information about the Python-list mailing list