[python-win32] pythoncom.Pumpwaitingmessages() overloaded

Mark Hammond mhammond at skippinet.com.au
Tue Mar 28 17:38:26 EDT 2023


On 29/03/2023 5:38 am, Philip Carr wrote:
> Hi
> 
> Im looking for help on pythoncom.PumpWaitingMessages(). I’m using it to 
> connect to a Windows application that has a com object to stream stock 
> prices.
> 
> It works fine most of the time but when the rate of new events/messages 
> gets too high ( unscientifically about 50 a second i think it can 
> handle) it grinds to a halt and basically stops processing new 
> events/messages and doesn't catch up even if the rate of new 
> events/messages slows down. .

I can't explain why it doesn't recover, but you would certainly expect 
this to be quite slow given Python is executing an infinite loop.

> Replacing the loop with just pythoncom.PumpMessages() also works, but I 
> have no idea if this is more or less robust?

That should be more robust and performant in your scenario. The only 
time you should use PumpWaitingMessages is when that infinite loop isn't 
what you want.

HTH,

Mark



More information about the python-win32 mailing list