-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[BUG] TypeError not callable : rich.print_exception #1492
Comments
I'm guessing that Tortoise ORM does some magic which breaks the pretty printing. It appears as though |
No, I have not used grep -r "__rich_repr__" .
./.venv/lib/python3.9/site-packages/rich/layout.py: ...
./.venv/lib/python3.9/site-packages/rich/color.py: ...
... Then might it be a ps:
pypika.queries.Table inherits from pypike.queries.Selectable which has a |
To reproduce the error : from rich.console import Console
console = Console()
class Field:
def __init__(self, name):
self.name = name
class Table:
def __getattr__(self, name):
return Field(name)
if __name__ == "__main__":
try:
t = Table()
raise BaseException("Whatever")
except BaseException:
console.print_exception(extra_lines=5, show_locals=True) |
Did I solve your problem? Consider sponsoring the ongoing work on Rich and Textual. Or buy me a coffee to say thanks. |
Please try v10.10.0 Fixes your example code. |
Perfect ! I tried, it works smooth, thx :) |
10.10.0 Added Added stdin support to rich.json Fixed Fixed pretty printing of objects with fo magic with getattr Textualize/rich#1492
Hello !
Describe the bug
I use print_exception with uvicorn and print_exception got an exception "Field not Callable", I patched uvicorn/protocols/http/httptools_impl.py:404 this way
The exception which occured (the first part is the error in my side ; the second is the error in rich, both printed by uvicorn)
To Reproduce
It is complex to reproduce it :/ Maybe I could reproduce it, it seems to come from tortoise orm, I will try later.
Platform
Linux
Diagnose
I quickly fixed the problem (but it seems to reduce the quantity of details) by patching rich this way (rich/pretty.py:509) :
The text was updated successfully, but these errors were encountered: