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

Error: F1 - About crashes because Package 'textual.widgets' has no class '__wrapped__' #57

Closed
jeertmans opened this issue Aug 22, 2023 · 4 comments
Labels
bug Something isn't working

Comments

@jeertmans
Copy link

jeertmans commented Aug 22, 2023

Hello!

When trying to add a TUI to my program, see jeertmans/manim-slides#249, the TUI crashes when pressing F1. The issue seems to also occur during tests, see logs.

I have attached the full error traceback below.

Thanks!

╭─────────────── Traceback (most recent call last) ────────────────╮
│ /home/eertmans/.cache/pypoetry/virtualenvs/manim-slides-M-PeeMP- │
│ -py3.10/lib/python3.10/site-packages/trogon/trogon.py:138 in     │
│ action_about                                                     │
│                                                                  │
│   135 │   │   self.app.exit()                                    │
│   136 │                                                          │
│   137 │   def action_about(self) -> None:                        │
│ ❱ 138 │   │   from .widgets.about import AboutDialog             │
│   139 │   │                                                      │
│   140 │   │   self.app.push_screen(AboutDialog())                │
│   141                                                            │
│                                                                  │
│ ╭──────── locals ─────────╮                                      │
│ │ self = CommandBuilder() │                                      │
│ ╰─────────────────────────╯                                      │
│                                                                  │
│ /home/eertmans/.cache/pypoetry/virtualenvs/manim-slides-M-PeeMP- │
│ -py3.10/lib/python3.10/site-packages/trogon/widgets/about.py:8   │
│ in <module>                                                      │
│                                                                  │
│     5 from textual.binding import Binding                        │
│     6 from textual.containers import Center, Vertical            │
│     7 from textual.screen import ModalScreen                     │
│ ❱   8 from textual.widgets import Button, Static                 │
│     9 from textual.widgets._button import ButtonVariant          │
│    10                                                            │
│    11                                                            │
│                                                                  │
│ ╭──────────────────────── locals ────────────────────────╮       │
│ │       Binding = <class 'textual.binding.Binding'>      │       │
│ │        Center = <class 'textual.containers.Center'>    │       │
│ │ ComposeResult = typing.Iterable[textual.widget.Widget] │       │
│ │   ModalScreen = <class 'textual.screen.ModalScreen'>   │       │
│ │          Text = <class 'rich.text.Text'>               │       │
│ │      TextType = typing.Union[str, ForwardRef('Text')]  │       │
│ │      Vertical = <class 'textual.containers.Vertical'>  │       │
│ ╰────────────────────────────────────────────────────────╯       │
│                                                                  │
│ in feature_imported:61                                           │
│                                                                  │
│ in feature_imported:137                                          │
│                                                                  │
│ in _mod_uses_pyside:148                                          │
│                                                                  │
│ /usr/lib/python3.10/inspect.py:1139 in getsource                 │
│                                                                  │
│   1136 │   The argument may be a module, class, method, function 
│   1137 │   or code object.  The source code is returned as a sin │
│   1138 │   OSError is raised if the source code cannot be retrie │
│ ❱ 1139 │   lines, lnum = getsourcelines(object)                  │
│   1140 │   return ''.join(lines)                                 │
│   1141                                                           │
│   1142 # --------------------------------------------------- cla │
│                                                                  │
│ ╭─────────────────────────── locals ───────────────────────────╮ │
│ │ object = <module 'textual.widgets' from                      │ │
│ │          '/home/eertmans/.cache/pypoetry/virtualenvs/manim-… │ │
│ ╰──────────────────────────────────────────────────────────────╯ │
│                                                                  │
│ /usr/lib/python3.10/inspect.py:1120 in getsourcelines            │
│                                                                  │
│   1117 │   corresponding to the object and the line number indic │
│   1118 │   original source file the first line of code was found │
│   1119 │   raised if the source code cannot be retrieved."""     │
│ ❱ 1120 │   object = unwrap(object)                               │
│   1121 │   lines, lnum = findsource(object)                      │
│   1122 │                                                         │
│   1123 │   if istraceback(object):                               │
│                                                                  │
│ ╭─────────────────────────── locals ───────────────────────────╮ │
│ │ object = <module 'textual.widgets' from                      │ │
│ │          '/home/eertmans/.cache/pypoetry/virtualenvs/manim-… │ │
│ ╰──────────────────────────────────────────────────────────────╯ │
│                                                                  │
│ /usr/lib/python3.10/inspect.py:639 in unwrap                     │
│                                                                  │
│    636 │   # ensure they aren't destroyed, which would allow the │
│    637 │   memo = {id(f): f}                                     │
│    638 │   recursion_limit = sys.getrecursionlimit()             │
│ ❱  639 │   while _is_wrapper(func):                              │
│    640 │   │   func = func.__wrapped__                           │
│    641 │   │   id_func = id(func)                                │
│    642 │   │   if (id_func in memo) or (len(memo) >= recursion_l │
│                                                                  │
│ ╭─────────────────────────── locals ───────────────────────────╮ │
│ │     _is_wrapper = <function unwrap.<locals>._is_wrapper at   │ │
│ │                   0x7f0d12e38ee0>                            │ │
│ │               f = <module 'textual.widgets' from             │ │
│ │                   '/home/eertmans/.cache/pypoetry/virtualen… │ │
│ │            func = <module 'textual.widgets' from             │ │
│ │                   '/home/eertmans/.cache/pypoetry/virtualen… │ │
│ │            memo = {                                          │ │
│ │                   │   139695144842192: <module               │ │
│ │                   'textual.widgets' from                     │ │
│ │                   '/home/eertmans/.cache/pypoetry/virtualen… │ │
│ │                   }                                          │ │
│ │ recursion_limit = 1000                                       │ │
│ │            stop = None                                       │ │
│ ╰──────────────────────────────────────────────────────────────╯ │
│                                                                  │
│ /usr/lib/python3.10/inspect.py:630 in _is_wrapper                │
│                                                                  │
│    627 │   """                                                   │
│    628 │   if stop is None:                                      │
│    629 │   │   def _is_wrapper(f):                               │
│ ❱  630 │   │   │   return hasattr(f, '__wrapped__')              │
│    631 │   else:                                                 │
│    632 │   │   def _is_wrapper(f):                               │
│    633 │   │   │   return hasattr(f, '__wrapped__') and not stop │
│                                                                  │
│ ╭─────────────────────────── locals ───────────────────────────╮ │
│ │ f = <module 'textual.widgets' from                           │ │
│ │     '/home/eertmans/.cache/pypoetry/virtualenvs/manim-slide… │ │
│ ╰──────────────────────────────────────────────────────────────╯ │
│                                                                  │
│ /home/eertmans/.cache/pypoetry/virtualenvs/manim-slides-M-PeeMP- │
│ -py3.10/lib/python3.10/site-packages/textual/widgets/__init__.py │
│ :96 in __getattr__                                               │
│                                                                  │
│    93 │   │   pass                                               │
│    94 │                                                          │
│    95 │   if widget_class not in __all__:                        │
│ ❱  96 │   │   raise ImportError(f"Package 'textual.widgets' has  │
│    97 │                                                          │
│    98 │   widget_module_path = f"._{camel_to_snake(widget_class) │
│    99 │   module = import_module(widget_module_path, package="te │
│                                                                  │
│ ╭─────────── locals ───────────╮                                 │
│ │ widget_class = '__wrapped__' │                                 │
│ ╰──────────────────────────────╯                                 │
╰──────────────────────────────────────────────────────────────────╯
ImportError: Package 'textual.widgets' has no class '__wrapped__'
@daneah
Copy link
Collaborator

daneah commented Oct 2, 2024

Hey @jeertmans, can you confirm whether this is still an issue using trogon==0.6.0?

@daneah daneah added the bug Something isn't working label Oct 2, 2024
@jeertmans
Copy link
Author

jeertmans commented Oct 2, 2024

I did bump the package: the TUI works, except for one command present, that fails when selecting it (TypeError: '<' not supported between instances of 'NoneType' and 'NoneType').

See error logs attached. But I guess this is another issue?

I have updated jeertmans/manim-slides#249 to you can checkout it if you want to test locally.

logs.txt

@daneah
Copy link
Collaborator

daneah commented Oct 2, 2024

Yep, I think that new error looks suspiciously like #56!

@jeertmans
Copy link
Author

Yes instead, I forgot I posted that issue too 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants