[python-win32] Releasing a Com object

Mark Hammond skippy.hammond at gmail.com
Wed Jan 21 00:08:11 CET 2009


On 21/01/2009 6:13 AM, Gary Scorby wrote:
> You are correct, it no longer refers to the object.  I should have added
> a few more details. Windows still believes the object is in use, in this
> case it’s a dll. Nothing else can be done with the dll until Python is
> completely shut down. None of the other dll com objects I have used in
> the past have had this problem.

The DLL has been loaded into the Python process?  Freeing an object 
doesn't guarantee the DLL will be unloaded - you could try 
pythoncom.CoFreeUnusedLibraries().  Alternatively, try and use an 
out-of-process version of the object...

Mark

>
> Thanks
>
> Gary
>
> *From:* bob gailer [mailto:bgailer at gmail.com]
> *Sent:* Tuesday, January 20, 2009 11:05 AM
> *To:* Gary Scorby
> *Cc:* python-win32 at python.org
> *Subject:* Re: [python-win32] Releasing a Com object
>
> Gary Scorby wrote:
>
> I’m having trouble releasing a com object. In the past I’ve always set
> the instance to None and life is good, as in the example below. I’m
> currently working with an object I can’t release with this method.
> Anybody have a different/better way to handle this?
>
>
> "can’t release" - what does that mean? Certainly xxx no longer refers to
> the object.
>
> Thanks
>
> Gary
>
> # example
>
> xxx = win32com.client.Dispatch('abcd.XXX')
>
> # to release
>
> xxx = None
>
> --
> Bob Gailer
> Chapel Hill NC
> 919-636-4239
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32



More information about the python-win32 mailing list