jupyter/jupyter_core

RFE: Don't traceback on command not found

hroncok opened this issue · 2 comments

Hello. Currently, when a command is not found, Jupter prints a traceback on the user:

$ jupyter foobar
Traceback (most recent call last):
  File "/usr/bin/jupyter", line 33, in <module>
    sys.exit(load_entry_point('jupyter-core==4.6.3', 'console_scripts', 'jupyter')())
  File "/usr/lib/python3.9/site-packages/jupyter_core/command.py", line 247, in main
    command = _jupyter_abspath(subcommand)
  File "/usr/lib/python3.9/site-packages/jupyter_core/command.py", line 133, in _jupyter_abspath
    raise Exception(
Exception: Jupyter command `jupyter-foobar` not found.

Generally, I believe users should only see tracebacks when they are debugging stuff or when there is an unexpected "crash". An error message formatted for the user is much better UX.

In fact, in Fedora, such traceback is detected as crash and the automatic bug reporting tool:

_

Apparently, many users are hit by this: https://retrace.fedoraproject.org/faf/reports/24959/

Would you accept a PR that changes the exception to printing an error message to stderr instead?

Yes, that would be a good PR. Thanks for working on the UX of the command-line tool.