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

TypeError: Message.__init__() takes 1 positional argument but 2 were given #3

Closed
davetapley opened this issue Mar 26, 2023 · 1 comment · Fixed by #4
Closed

TypeError: Message.__init__() takes 1 positional argument but 2 were given #3

davetapley opened this issue Mar 26, 2023 · 1 comment · Fixed by #4

Comments

@davetapley
Copy link
Contributor

Broken since Textualize/textual#1940 / Textualize/textual@373fc95

Because of super call here:

class Changed(Message, bubble=True):
"""Value was changed."""
def __init__(self, sender: Select, value: str) -> None:
super().__init__(sender)


╭───────────────────────────────── Traceback (most recent call last) ─────────────────────────────────╮│·
│ /home/dave/.pyenv/versions/ng/lib/python3.10/site-packages/textual_select/_select.py:329 in         ││·
│ watch_value                                                                                         ││·
│                                                                                                     ││·
│   326 │   │   │   self.text = ""                                                                    ││·
│   327 │   │   │   self.select_list.list_view.index = 0                                              ││·
│   328 │   │   │   self.refresh(layout=True)                                                         ││·
│ ❱ 329 │   │   await self.post_message(self.Changed(self, value))                                    ││·
│   330 │                                                                                             ││·
│   331 │   class Changed(Message, bubble=True):                                                      ││·
│   332 │   │   """Value was changed."""                                                              ││·
│                                                                                                     ││·
│ ╭────────────────── locals ──────────────────╮                                                      ││·
│ │  self = Select(pseudo_classes={'enabled'}) │                                                      ││·
│ │ value = 1                                  │                                                      ││·
│ ╰────────────────────────────────────────────╯                                                      ││·
│                                                                                                     ││·
│ /home/dave/.pyenv/versions/ng/lib/python3.10/site-packages/textual_select/_select.py:335 in         ││·
│ __init__                                                                                            ││·
│                                                                                                     ││·
│   332 │   │   """Value was changed."""                                                              ││·
│   333 │   │                                                                                         ││·
│   334 │   │   def __init__(self, sender: Select, value: str) -> None:                               ││·
│ ❱ 335 │   │   │   super().__init__(sender)                                                          ││·
│   336 │   │   │   self.value = value                                                                ││·
│   337 │   │   │   self.select = sender                                                              ││·
│   338                                                                                               ││·
│                                                                                                     ││·
│ ╭────────────────── locals ───────────────────╮                                                     ││·
│ │   self = Changed()                          │                                                     ││·
│ │ sender = Select(pseudo_classes={'enabled'}) │                                                     ││·
│ │  value = 1                                  │                                                     ││·
│ ╰─────────────────────────────────────────────╯                                                     ││·
╰─────────────────────────────────────────────────────────────────────────────────────────────────────╯│·
TypeError: Message.__init__() takes 1 positional argument but 2 were given 
@mitosch
Copy link
Owner

mitosch commented Mar 27, 2023

Hi Dave

Thank you for your pull-request. It should be fixed with textua-select 0.3.3.

Best regads

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

Successfully merging a pull request may close this issue.

2 participants