A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2001-April/097580.html below:

win32com_garbage collection, another QTN

win32com_garbage collection, another QTNMark Hammond MarkH at ActiveState.com
Sun Apr 22 22:12:56 EDT 2001
zzzzz wrote:
...

> My problem is excel, and getting it to close properly:
> 
> ---------------------------------------------------------
> import win32com.client
> 
> 
> state=win32com.client.Dispatch("Excel.application")
> state.Workbooks.Open("G:\\MH_State_Flow_7.xls")
> state.Visible=1
> 


What goes in here is suspect :)


> ## read stuff from excel worksheet without modifying file
> 
> state.Visible=0
> state.Quit()   # This is what was suggested to the previous QTN
> del state
> ----------------------------------------------------------
> 
> According to what I've read, this sequence of quit commands should
> close excel (even without the .Quit command). To all appearances this
> is true, however, when I look at the task manager (I'm using NT4.0sp6)
> good old excel.exe is still running. The only way to close it cleanly
> (that I know of) is to close the interpreter.


  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.


More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4