win32com.client problem

It's me itsme at yahoo.com
Wed Jan 5 15:29:47 EST 2005


Thanks for the reply.  I will chew on this a bit.

"Kartic" <kartic.krishnamurthy at gmail.com> wrote in message
news:1104955511.276842.316210 at f14g2000cwb.googlegroups.com...
> Hi,
>
> 1. Put your COM invokations in a try/except loop. From my experience,
> that helped me prevent, in most cases, Excel from "hanging" and having
> to restart the PC too. In the except part, release the Excel (or other
> COM resource) (e.g.calling workbook.Close() or excelobj.Quit(),
> depending on the state of your program)
>
> 2. Look at
> http://www.faqts.com/knowledge_base/entry/versions/index.phtml?aid=5847
> to see how to get the actual error.
>
> 3. Delete instances of the COM connection, RS object or whatever
> win32com.client instances you create. I do this:
> sheetobj = None
> wbkbobj = None
> excelobj = None
> del sheetobj
> del wbkobj
> del excelobj
>
> 4. At the end of my scripts, I do the following during the development
> stage:
> ActiveComConn = pythoncom._GetInterfaceCount()
> print 'Done! Active Com Connections :',ActiveComConn # Print count of
> Active COM connections.
>
> Thank you,
> --Kartic
>





More information about the Python-list mailing list