[python-win32] win32com.client - How to raise an exception after timeout

Gregory Piñero gregpinero at gmail.com
Tue Dec 27 22:07:01 CET 2005


Hi guys,

I'm working with the COM stuff in python-win32 to talk to QuickBooks
and in the last line of the code below, the function just hangs
(forever?).  I was hoping someone could enlighten me on how to have an
exception raised after a specified time has passed so I can clean up
and continue my program?

<code>
import win32com.client
from QBCONSTANTS import * #all the QB consts?
qbxmlrp = win32com.client.DispatchEx("QbXMLRP2e.RequestProcessor")
qbxmlrp.OpenConnection(None, application_name)
qbxmlrp.BeginSession(r'file1.qbw',
win32com.client.constants.qbFileOpenDoNotCare)
</code>

What I've tried so far:

I looked into doing a Python threading approach, but even when I
figured out how to kill a thread (http://tinyurl.com/ey7lo), I can't
do it here because this function is stalling below the Python level. 
Even then I found a Unix only solution
(http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/307871) using
the signal module but that doens't help me here.

Any help is greatly appriciated.

--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)


More information about the Python-win32 mailing list