Closed inducer closed 4 years ago
It looks like pudb can still crash if you run a file with unicode in a terminal that cannot render ASCII:
Traceback (most recent call last):
File "/Users/aaronmeurer/Documents/pudb/pudb/__init__.py", line 153, in runscript
dbg._runscript(mainpyfile)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 487, in _runscript
self.run(statement)
File "/Users/aaronmeurer/anaconda3/lib/python3.7/bdb.py", line 585, in run
exec(cmd, globals, locals)
File "<string>", line 1, in <module>
File "test.py", line 4, in <module>
s="testing unicode \xe4\xf6\xe4\xf6\xe4\xf6"
File "test.py", line 4, in <module>
s="testing unicode \xe4\xf6\xe4\xf6\xe4\xf6"
File "/Users/aaronmeurer/anaconda3/lib/python3.7/bdb.py", line 88, in trace_dispatch
return self.dispatch_line(frame)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 208, in dispatch_line
self.user_line(frame)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 429, in user_line
self.interaction(frame)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 397, in interaction
show_exc_dialog=show_exc_dialog)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2200, in call_with_ui
return f(*args, **kwargs)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2461, in interaction
self.event_loop()
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2420, in event_loop
self.screen.draw_screen(self.size, canvas)
File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urwid/raw_display.py", line 868, in draw_screen
self.write(l)
File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urwid/raw_display.py", line 286, in write
self._term_output_file.write(data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 19-24: ordinal not in range(128)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/aaronmeurer/anaconda3/lib/python3.7/runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "/Users/aaronmeurer/anaconda3/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/aaronmeurer/Documents/pudb/pudb/run.py", line 38, in <module>
main()
File "/Users/aaronmeurer/Documents/pudb/pudb/run.py", line 34, in main
steal_output=options.steal_output)
File "/Users/aaronmeurer/Documents/pudb/pudb/__init__.py", line 160, in runscript
dbg.interaction(None, sys.exc_info())
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 397, in interaction
show_exc_dialog=show_exc_dialog)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2200, in call_with_ui
return f(*args, **kwargs)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2448, in interaction
self.show_exception_dialog(exc_tuple)
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2146, in show_exception_dialog
("Save traceback", "save"),
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2119, in dialog
return self.event_loop(w)[0]
File "/Users/aaronmeurer/Documents/pudb/pudb/debugger.py", line 2420, in event_loop
self.screen.draw_screen(self.size, canvas)
File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urwid/raw_display.py", line 868, in draw_screen
self.write(l)
File "/Users/aaronmeurer/anaconda3/lib/python3.7/site-packages/urwid/raw_display.py", line 286, in write
self._term_output_file.write(data)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 23-28: ordinal not in range(128)
(to reproduce, tell your terminal emulator to set the character encoding to ASCII, then run the file from https://github.com/inducer/pudb/issues/278#issuecomment-640374755)
278