Skip to content

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

@jeertmans

Description

@jeertmans

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__'

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions