I am trying to use pudb to debug with multiprocessing, but I encounter error as below:
Code:
def worker():
i = 0
while i < 10:
pudb.set_trace()
i = i + 1
time.sleep(1)
if __name__ == '__main__':
p1 = multiprocessing.Process(target=worker)
p1.start()
Error:
File "/usr/local/lib/python2.7/dist-packages/urwid/raw_display.py", line 545, in _getch
return ord(os.read(self._term_input_file.fileno(), 1))
TypeError: ord() expected a character, but string of length 0 found
Does anyone know about this problem?
This works since pudb version
2020.1
usingpudb.forked.set_trace()
.See also https://documen.tician.de/pudb/starting.html#using-the-debugger-after-forking for a similar example.
Disclosure: I authored this.