[python-win32] COM with timeouts?

Stephen Hansen apt.shansen at gmail.com
Mon Feb 9 18:12:35 CET 2009


Hi all.

I have an application that's controlling Word via COM, and have
situations where I'd like to set a timeout on those operations. Word
might throw up an error message for example which stalls everything
until clicked. In such a case I'd rather just give up, go and kill
Word and start over.

My first thought was: why, I'll wrap the calls in a context manager
that sets a SIGALRM. Then remembered Windows didn't support SIGALRM,
and cried inside.

Any tips on an approach to take to interrupt a COM call or set a timeout on it?

Thanks in advance.

--Stephen


More information about the python-win32 mailing list