----- Original Message -----
From: Matthew
Sent: Thursday, January 31, 2002 10:05 AM
Subject: [Komodo-discuss] Debugger Prob Hi all,
I wrote an app for automating IE. The Komodo
debugger doesn't stop on breakpoints called from
pythoncom.PumpWaitingMessages.
pdb doesn't stop either.
At present i'm using pdb.set_trace().
I'm having trouble convincing my work mates of the
coolness of Python!
Any help appreciated :)
GBU
Matthew Sherborne
code:
def _MessageLoop(self):
""" This loops and runs messages until the browser is quit, or condition is 'false' ('0') """ while 1: rc = win32event.MsgWaitForMultipleObjects( (StopEvent,), 0, # wait for all = false win32event.QS_ALLEVENTS, # type of input TIMEOUT) # (or win32event.INFINITE) # You
can call a function here if it doesn't take too
long.
# It will get executed *at least* every 200ms -- possibly # a lot more, depending on the number of windows messages received. if rc == win32event.WAIT_OBJECT_0+0: # Our first event listed was triggered. # Someone wants us to exit. break elif rc == win32event.WAIT_OBJECT_0+1: # A windows message is waiting - take care of it. # (Don't ask me why a WAIT_OBJECT_MSG isn't defined < WAIT_OBJECT_0) # Note: this must be done for COM and other windowsy # things to work. if pythoncom.PumpWaitingMessages(): break # result == 1 == wm_quit msg was received elif rc == win32event.WAIT_TIMEOUT: # Our timeout has elapsed. # Do some work here (e.g, poll something can you can't thread) # or just feel good to be alive. # Good place to call watchdog(). (Editor's note: See my "thread lifetime" recepie.) pass else: raise RuntimeError("unexpected win32wait return value: %d" % rc) |