win32com_garbage collection, another QTN

zzzzz zzizz_ at notmail.com
Wed Apr 25 22:46:00 EDT 2001


On Mon, 23 Apr 2001 02:12:56 GMT, Mark Hammond <MarkH at ActiveState.com>
wrote:

>zzzzz wrote:
>...
>
>> My problem is excel, and getting it to close properly:
>> 

>> 
>> state=win32com.client.Dispatch("Excel.application")
The following command returns a Workbooks object that I don't assign
to anything:
>> state.Workbooks.Open("G:\\MH_State_Flow_7.xls")
If I do:

wbook=state.Workbooks.Open("G:\\MH_State_Flow_7.xls")

and then:

state,wbook=None,None

then this works & I don't need to call the Quit() command.
>
>  There is a good chance you still have a COM reference left alive. 
>Check what pythoncom._GetInterfaceCount() returns, and if non-zero you 
>have another reference - probably the document or worksheet object.
>
>Mark.

Regards,

zzzzz.
---------------------



More information about the Python-list mailing list