Fredrik> if isinstance(exc_value, NameError) and not exc_info.tb_next: Fredrik> text = exc_value[0] Fredrik> name = ... extract name from nameerror string ... Fredrik> if sys.commandline.strip() == name: Fredrik> if name in ("exit", "quit"): Fredrik> raise SystemExit Fredrik> if name == "help": Fredrik> help() Fredrik> return Fredrik> ... Fredrik> any suggestions on how to improve this ? I'd make it sys._last_input or something similar to make it clear that a) this is magic, don't mess with it, and that b) this is the last user input, not the raw command line. Skip
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4