[python-win32] COM with timeouts?

Stephen Hansen apt.shansen at gmail.com
Tue Feb 10 03:44:52 CET 2009


On Mon, Feb 9, 2009 at 4:18 PM, Mark Hammond <skippy.hammond at gmail.com> wrote:
> If you kill the Word process, you could expect the COM RPC mechanism will
> then return from the blocked call with some exception.

... Oh. Yes, that's brilliant. The thought never occurred to me to let
the kill_word code itself serve as my sigalrm and interrupt the
blocking call.

I just "with timeout(token, 5): document.DoSomething" and have the
timeout contextmanager add/remove pending cancellations from a thread
that chain-sleeps waiting for any to run out when any are registered.

Works just fine so far.

Thanks.

--S


More information about the python-win32 mailing list