question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

config option to truncate traceback

See original GitHub issue

It would be useful to be able to be able to have the option to truncate the display of error traceback. When writing documentation, it is useful just to show that an error occurred without showing the full traceback. This practice is commonly done in terminal view.

There is sys.tracebacklimit setting. However, it does not work in Jupyter and needs a rather complex override: https://stackoverflow.com/questions/46222753/how-do-i-suppress-tracebacks-in-jupyter

I would propose adding a jupyter_sphinx_truncate_traceback option that would just show the first two lines of the normal traceback message followed by an ellipsis, e.g.

---------------------------------------------------------------------------
ZeroDivisionError                         Traceback (most recent call last)
...

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
danielballancommented, Oct 8, 2019

Would running %xmode Minimal, perhaps in a hidden cell, address this use case for Python-based kernels?

0reactions
seanpuecommented, Oct 8, 2019

Thanks @danielballan! That’s a great solution, and it works in this use case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

python - Hide traceback unless a debug flag is set
The short way is using the sys module and use this command: sys.tracebacklimit = 0. Use your flag to determine the behaviour. Example:...
Read more >
Understanding the Python Traceback
In this step-by-step tutorial, you'll learn how to read and understand the information you can get from a Python traceback. You'll walk through...
Read more >
traceback — Print or retrieve a stack traceback — Python 3.11 ...
Return a StackSummary object representing a list of “pre-processed” stack trace entries extracted from the traceback object tb. It is useful for alternate ......
Read more >
traceback: Get and Print Call Stacks - Rdrr.io
traceback () returns the deparsed call stack deepest call first as a list or pairlist. The number of lines deparsed from the call...
Read more >
Creating Beautiful Tracebacks with Python's Exception Hooks
traceback . Another popular option is better_exceptions . It also produces nice output, but requires a little more setup: # https://github.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found