Stepping through a multithreaded program

Fernando Rodríguez fernandoSPAM.YOURSELF at fernando-rodriguez.com
Sat Sep 4 17:02:45 CEST 2004


Hi,

I was trying to step through a first attemp of multithreaded script (see
below), with PythonWin, but I'm gettign a very strange error:

---------------------------------------------------------------------------------
import threading

times = 100
delay = 10000

class egoistThread(threading.Thread):
    def __init__(self, id, times, delay):
        threading.Thread.__init__(self)
        self.id = id
        self.times = times
        self.delay = delay
    def run(self):
        for i in xrange(self.times):
            print self.id,
            for j in xrange(self.delay):
                pass

egoists = []
for elt in 'abc':
    egoists.append(egoistThread(elt, times, delay))

"""
When I reach this point, I get a weird error see below
"""
for ego in egoists:
    ego.start()


for ego in egoists:
    ego.join()
------------------------------------------------------------------------------

The error is:
Traceback (most recent call last):
  File
"C:\ARCHIV~1\python23\lib\site-packages\Pythonwin\pywin\framework\dbgcommands.py",
line 65, in OnStepOver
    self._DoOrStart("do_set_next", scriptutils.RS_DEBUGGER_STEP)
  File
"C:\ARCHIV~1\python23\lib\site-packages\Pythonwin\pywin\framework\dbgcommands.py",
line 57, in _DoOrStart
    method()
  File
"C:\ARCHIV~1\python23\lib\site-packages\Pythonwin\pywin\debugger\debugger.py",
line 629, in do_set_next
    if self.GUIAboutToRun():
  File
"C:\ARCHIV~1\python23\lib\site-packages\Pythonwin\pywin\debugger\debugger.py",
line 788, in GUIAboutToRun
    if not self.StopDebuggerPump():
  File
"C:\ARCHIV~1\python23\lib\site-packages\Pythonwin\pywin\debugger\debugger.py",
line 484, in StopDebuggerPump
    assert self.pumping, "Can't stop the debugger pump if Im not pumping!"
AssertionError: Can't stop the debugger pump if Im not pumping!

Any ideas? O:-)



More information about the Python-list mailing list