Python and Excel

Mark Hammond MarkH at ActiveState.com
Thu Oct 26 19:18:24 EDT 2000


"Hans Kristian Ruud" <hans.kristian.ruud at inenco.no> wrote in message
news:39F8887E.208FA9AA at inenco.no...

> When the application is finished, it tries to shut Excel down by
calling
> xlBook.Close():
>
> xlBook.Close(SaveChanges=0)
> del xlApp

Note that you are zapping xlApp, but _not_ xlBook.  This object still
holds a reference to Excel.  Try deleting this too.

Also, you can try calling "pythoncom.CoUninitialize()" as you
terminate.  This _may_ prevent the crash.

In general, as you exit, print the value of
pythoncom._GetInterfaceCount() should return 0.  If it doesn't, you
still have Python COM objects alive that need to be zapped.  If you
get this to zero as you terminate, you almost certainly will be
fine...

Mark.






More information about the Python-list mailing list