[python-win32] win32com.client - How to raise an exceptionafter timeout
Roger Upole
rwupole at msn.com
Sun Jan 15 17:21:23 CET 2006
The question is probably better addressed to whoever
develops the COM application you're calling. There's
probably no real general solution.
If the application doesn't have any built-in abort
mechanism or asynch processing, it may not
be safe to just kill it. You could wind up with a
reference to a corrupted object in your
main thread, causing crashes (or worse).
Roger
----- Original Message -----
From: "Gregory Piñero" <gregpinero at gmail.com>
To: <python-win32 at python.org>
Sent: Friday, January 13, 2006 5:36 PM
Subject: Re: [python-win32] win32com.client - How to raise an exceptionafter
timeout
After more research, I believe there is no answer for this. I'd like
to write a PEP for this problem but I'm not sure I know enough. Can
anyone help? Is this perhaps a better question for the Python users
or developers list?
Thanks,
Greg
On 12/27/05, Gregory Piñero <gregpinero at gmail.com> wrote:
> 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)
>
--
Gregory Piñero
Chief Innovation Officer
Blended Technologies
(www.blendedtechnologies.com)
More information about the Python-win32
mailing list