You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm running a python repl in an educational context, and I would like to catch top level errors of certain types where I can give more clear and complete guidance (and suppress tracebacks where appropriate). I love what ptpython offers, and I would like to use it here. Is there a relatively simple way to adapt ptpython to customize error handling at the top level of the interactive shell?
If there is no direct way, it looks like modifying/wrapping PythonRepl._handle_exception could work, but perhaps there's a better or simpler way? Or perhaps that won't work at all for some reason? My first thought was to allow an optional kw argument to the PythonRepl constructor that takes a custom error handler and that this handler is tried first, then the current _handle_exception if the former is missing or passes. Sound plausible, or crazy?
Thanks for your help!
The text was updated successfully, but these errors were encountered:
I'm running a python repl in an educational context, and I would like to catch top level errors of certain types where I can give more clear and complete guidance (and suppress tracebacks where appropriate). I love what ptpython offers, and I would like to use it here. Is there a relatively simple way to adapt ptpython to customize error handling at the top level of the interactive shell?
If there is no direct way, it looks like modifying/wrapping
PythonRepl._handle_exception
could work, but perhaps there's a better or simpler way? Or perhaps that won't work at all for some reason? My first thought was to allow an optional kw argument to thePythonRepl
constructor that takes a custom error handler and that this handler is tried first, then the current_handle_exception
if the former is missing or passes. Sound plausible, or crazy?Thanks for your help!
The text was updated successfully, but these errors were encountered: