[python-win32] how can I do marshall.ReleaseComObject in python ?? [SEC=UNCLASSIFIED]

Andrew MacIntyre Andrew.MacIntyre at acma.gov.au
Tue Sep 11 02:47:40 CEST 2012


[sorry for top-post]

You probably need to release the Python object that is wrapping the COM object.

Given a variable x holding a COM object reference, either:

    del x

or

    x = None

should force release of any COM object reference.

Which to use depends on taste and context - the latter approach for example being perhaps more usual when dealing with object attributes.

-------------------------> "These thoughts are mine alone!" <---------
Andrew MacIntyre           Operations Branch
tel:   +61 2 6219 5356     Communications Infrastructure Division
fax:   +61 2 6253 3277     Australian Communications & Media Authority
email: andrew.macintyre at acma.gov.au<mailto:andrew.macintyre at acma.gov.au>            http://www.acma.gov.au/

From: python-win32 [mailto:python-win32-bounces+andrew.macintyre=acma.gov.au at python.org] On Behalf Of Matteo Boscolo
Sent: Tuesday, 11 September 2012 4:00 AM
To: python-win32 at python.org
Subject: [python-win32] how can I do marshall.ReleaseComObject in python ??

Hi All,

I'm Working on a cad program using the it's com interface

I have a python com object in witch I call a method as follows ..

    props=ent.Properties(True)
    #Ent is a IDocument
    this method is working well, and return a tuple of ITDProperty that are the property of the document.

The problem is when I close the document from the Cad application, the Cad application is unable to close the document because there is some reference still active.
I tried several way using the gc.collect(), to set to null each document pointer but with no result.
I tried to do the some kind of operation with c# and using the Marshal.ReleaseComObject(doc);, where doc is the  IDocument, and document is released and I'm free to close it from the interface.

now the question is how can I do the some staff as ReleaseComObject dose in python ?

its the Release method of the IUnknown interface the right way to do that ?

any hint is really appreciated, thanks

Regards,
Matteo




NOTICE: This email message is for the sole use of the intended recipient(s) 
 and may contain confidential and privileged information. Any unauthorized 
 review, use, disclosure or distribution is prohibited. If you are not the 
 intended recipient, please contact the sender by reply email and destroy all 
 copies of the original message.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-win32/attachments/20120911/a15ed207/attachment-0001.html>


More information about the python-win32 mailing list