Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using Traceback Handler has no effect #3266

Open
PhilippFeO opened this issue Jan 26, 2024 · 1 comment
Open

Using Traceback Handler has no effect #3266

PhilippFeO opened this issue Jan 26, 2024 · 1 comment

Comments

@PhilippFeO
Copy link

PhilippFeO commented Jan 26, 2024

Hey guys,

I setup rich as described in https://rich.readthedocs.io/en/latest/traceback.html but receive the standard python Traceback. I executed all files via python /tmp/rich-test.py after source ~/.venv/rich/bin/activate.

I don't know which pieces you need, so I included everything I found worth mentioning

cat ~/.venv/rich/lib/python3.10/site-packages/sitecustomize.py:

from rich.traceback import install
install(show_locals=True)

Python code to run:

a = 0
print(1/a)

Output:

Traceback (most recent call last):
  File "/tmp/rich-test.py", line 2, in <module>
    print(1/a)
ZeroDivisionError: division by zero

Further examples and information

importing sitecustomize

cat /tmp/rich-test.py

import sitecustomize
print(sitecustomize.__file__)

a = 0
print(1/a)

Output:

/usr/lib/python3.10/sitecustomize.py
Traceback (most recent call last):
  File "/tmp/rich-test.py", line 5, in <module>
    print(1/a)
ZeroDivisionError: division by zero

and output of cat /usr/lib/python3.10/sitecustomize.py:

# install the apport exception handler if available
try:
    import apport_python_hook
except ImportError:
    pass
else:
    apport_python_hook.install()

Using rich directly

~/.venv/rich/lib/python3.10/site-packages/sitecustomize.py from above unchanged.
cat /tmp/rich-test.py:

from rich.traceback import install
install(show_locals=True)

a = 0
print(1/a)

Output: Rich traceback's output.


Any help and hints are welcome! 👐 I'll provide you with whatever information you wish. 😊

Copy link

Thank you for your issue. Give us a little time to review it.

PS. You might want to check the FAQ if you haven't done so already.

This is an automated reply, generated by FAQtory

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant