[python-win32] Garbage collection of dispatched classes with dispatched classes

Metz, Bobby W, WCS bwmetz at att.com
Wed Apr 5 05:04:08 CEST 2006


	Hi, I'm hoping someone might provide some COM dispatching
insights as I'm relatively new to it in Python.  Does using static
binding provide for better garbage collection when the dispatched class
has dispatched classes of it's own?

The nitty gritty...

	I'm dispatching a registered class, HelpDesk, from python that
in turn automates another class, TicketList (has no API that Python can
use and there's no support for either class in order to know the full
details of the interaction).  The ListTicket class provides a portion of
the GUI within the HelpDesk GUI the user sees.  Basically, I'm
automating HelpDesk to pull info from it for my own GUI add-on and don't
care about TicketList; however, HelpDesk will always start ListTicket
and pass information to it and I can't prevent that.  So here's the
problem situation...
	If a user closes the HelpDesk instance I've dispatched, the GUI
closes but the actual .exe stays running under task man.  This appears
to happen because my program hasn't yet detected the close and set the
saved instance var to None.  Sometimes setting it to None under this
condition even causes an error in the hung HelpDesk .exe which doesn't
appear as an exception in Python, so I tend to use ProcessTerminate when
I detect the hung .exe.  The ListTicket program dispatched by HelpDesk
no longer appears in task man; however, after I kill the HelpDesk prog
and re-dispatch a new instance, the interaction between HelpDesk and
ListTicket doesn't work correctly, i.e. ListTicket prompts the user for
a piece of info that has already been provided to HelpDesk, one which it
never asks for normally.  Sometimes it even appears that ListTicket was
really still running (according to win32process.EnumProcesses).  I'm
doing dynamic instead of static binding of the HelpDesk class and I was
wondering if anyone thought this might be the root cause, i.e. any ideas
if using static binding would provide for better garbage collection when
the dispatched class has dispatched classes of it's own?

Thanks,

B


More information about the Python-win32 mailing list