debug gentoo emerge with pudb error
i am debug gentoo linux emerge script with pudb.
in /usr/lib/python3.8/site-packages/_emerge/main.py, i add
from pudb import set_trace; set_trace(paused=False)
from pudb.lowlevel import setlogfile; setlogfile("/tmp/pudberrors.log")
and
gymDeskGentoo ~/.config/pudb # cat saved-breakpoints-3.8
b /usr/lib/python3.8/site-packages/portage/process.py:374
the debugging runs ok, and the emerging process can finished fine, except that near the end of the process, i get an exception screen, but the screen only destroyed the display, i can still work with the terminal window and type clear command the clear the terminal display

in /tmp/pudberrors.log, i can find what follows:
[*** Pudb UI Exception Encountered: Error while showing error dialog *** Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2378, in call_with_ui return f(*args, **kwargs) File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2657, in interaction self.event_loop() File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2614, in event_loop keys = self.screen.get_input() File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 342, in get_input self._wait_for_input_ready(self._next_timeout) File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 542, in _wait_for_input_ready fd = self._input_fileno() File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 98, in _input_fileno return self._term_input_file.fileno() ValueError: I/O operation on closed file
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 443, in user_line self.interaction(frame) File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 409, in interaction self.ui.call_with_ui(self.ui.interaction, exc_tuple, File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2380, in call_with_ui self.hide() File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2373, in hide self.screen.stop() File "/usr/lib/python3.8/site-packages/urwid/display_common.py", line 821, in stop self._stop() File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 255, in _stop fd = self._input_fileno() File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 98, in _input_fileno return self._term_input_file.fileno() ValueError: I/O operation on closed file
During handling of the above exception, another exception occurred:
Traceback (most recent call last): File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2292, in show_internal_exc_dlg self._show_internal_exc_dlg(exc_tuple) File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2319, in _show_internal_exc_dlg self._show_exception_dialog( File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2327, in _show_exception_dialog res = self.dialog( File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2263, in dialog return self.event_loop(w)[0] File "/usr/lib/python3.8/site-packages/pudb/debugger.py", line 2614, in event_loop keys = self.screen.get_input() File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 342, in get_input self._wait_for_input_ready(self._next_timeout) File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 542, in _wait_for_input_ready fd = self._input_fileno() File "/usr/lib/python3.8/site-packages/urwid/raw_display.py", line 98, in _input_fileno return self._term_input_file.fileno() ValueError: I/O operation on closed file](url)
This looks like something closed standard input out from under pudb. Not much it can do in that case IMO. pudb is an interactive debugger, and without stdin, it has no way to receive user interactions. I'm kind of surprised it made it as far as it did, likely in no small part due to @mvanderkamp's careful job catching errors.
You could try to use pudb's remote debugging, which avoids sharing the debuggee's stdin/out.
thanks for suggesting remote debugging, but i still get issues, and i have created a new thread in gentoo forum: https://forums.gentoo.org/viewtopic-p-8620251.html#8620251




I'm inexperienced with this socket stuff but have you checked https://stackoverflow.com/questions/62847773/typeerror-utf-8-encode-argument-1-must-be-str-not-bytes ?