I try with both method but with no result:
the code is this :
    def GerPropValue2(self,name):
        try:
            oiDoc,ent=self._getCurrentEnt
            if ent!=None:
                props=ent.Properties(True)

                return "aaa" # Go out here for testing pourpuse

for i in range(0, len(props)): # check the len it could give some error logging.debug('_getProp : property found %s',str(props[i].Parent.Name))
                    if props[i].Parent.Name==name:
                        return props[i].Value
            return None
        finally:
            del ent
            del props
            del oiDoc
            props=None
            tdProp=None
            oiDoc=None
            ent=None

there is any way to debug how is the object deleted ?

regards,
Matteo


Il 11/09/2012 02:47, Andrew MacIntyre ha scritto:

[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.macint...@acma.gov.au <mailto:andrew.macint...@acma.gov.au> http://www.acma.gov.au/

*From:*python-win32 [mailto:python-win32-bounces+andrew.macintyre=acma.gov...@python.org] *On Behalf Of *Matteo Boscolo
*Sent:* Tuesday, 11 September 2012 4:00 AM
*To:* python-win32@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.



_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

_______________________________________________
python-win32 mailing list
python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to