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

Gamapad widget is broken #3719

Closed
DerThorsten opened this issue Mar 16, 2023 · 3 comments
Closed

Gamapad widget is broken #3719

DerThorsten opened this issue Mar 16, 2023 · 3 comments

Comments

@DerThorsten
Copy link

Description

Connecting to gamepad seems to be broken.
When connecting to the gamepad I see many errors in the log and the widget does not work.

  • I tried with various gamepads (Nintendo switch, 8BitDo Gamepad). All of them work on https://gamepad-tester.com/
  • I tried on MacOS and Ubuntu
  • I tried with ipywidgets 7,8 and the master

With all combinations I see the same errors.

Reproduce

run this code:

from ipywidgets import Controller
Controller()

the Log shows:

No such comm: 37c4b136-efef-477f-8dd9-63168b87adba
No such comm: 1e50c672-e195-427e-8e15-9e7b0dbbc14c
No such comm: 6cf01a0b-e72f-409a-965c-b0c1d63c6375
No such comm: 4e82d5d2-3caf-46a1-871b-3da1a4caa97c
No such comm: ec086860-993f-422f-b1c4-1e0ef2d0cc0d
No such comm: 9106956d-658e-4a38-aa82-008e7a995172
No such comm: cd9a1d26-4291-4a30-9622-ff24853204fe
No such comm: d8492c75-955d-44cd-9b00-a417bdb9dd85
No such comm: a6eb0e56-cf54-4a85-b438-0a46c2639535
No such comm: e6506a3b-fa4d-4246-bf04-a2587ebe0926
No such comm: 28b1fa3b-0086-4c82-aa15-dfc4a279b20b
No such comm: bc06d562-e0b8-46d2-a59d-ba643c627593
No such comm: 06bccf25-ca7e-469d-a68c-e2d566b8248a
No such comm: 7dfa4e3e-9907-4f25-8ea6-f8a06b8ed10d
No such comm: 4d38e7c7-387f-4dca-87f3-39010868aff6
No such comm: 17cd5388-31ed-42e1-a963-6adc246a4c0d
No such comm: 2627e4ee-fcaa-4409-8305-e10645b95445
No such comm: b41988dd-cd4d-44fa-8366-2d56bd818911
No such comm: ff524705-6aed-4e1d-bcb6-9151571143f4
No such comm: fdf2ec52-173b-4158-8e78-b0701509c6ab
No such comm: 6828c827-1c4a-4f9f-acd5-f808a403a8a3
No such comm: 30ccb20f-1cd7-4c0c-92fe-26c290b93842
No such comm: e955cc47-9114-412f-a4eb-fd789bd91874
No such comm: 2fe1a238-8539-4a2d-8b4d-7dc21898d4ab
No such comm: ff28d2a3-b4ad-47c4-b26e-dc0a9fecdd6d
12:35:31
---------------------------------------------------------------------------
TraitError                                Traceback (most recent call last)
File ~/src/ipywidgets/python/ipywidgets/ipywidgets/widgets/widget.py:766, in Widget._handle_msg(self, msg)
    764         if 'buffer_paths' in data:
    765             _put_buffers(state, data['buffer_paths'], msg['buffers'])
--> 766         self.set_state(state)
    768 # Handle a state request.
    769 elif method == 'request_state':

File ~/src/ipywidgets/python/ipywidgets/ipywidgets/widgets/widget.py:648, in Widget.set_state(self, sync_data)
    645 if name in self.keys:
    646     from_json = self.trait_metadata(name, 'from_json',
    647                                     self._trait_from_json)
--> 648     self.set_trait(name, from_json(sync_data[name], self))

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:1742, in HasTraits.set_trait(self, name, value)
   1740     raise TraitError(f"Class {cls.__name__} does not have a trait named {name}")
   1741 else:
-> 1742     getattr(cls, name).set(self, value)

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:706, in TraitType.set(self, obj, value)
    705 def set(self, obj, value):
--> 706     new_value = self._validate(obj, value)
    707     try:
    708         old_value = obj._trait_values[self.name]

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:738, in TraitType._validate(self, obj, value)
    736     return value
    737 if hasattr(self, "validate"):
--> 738     value = self.validate(obj, value)
    739 if obj._cross_validation_lock is False:
    740     value = self._cross_validate(obj, value)

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:2871, in Container.validate(self, obj, value)
   2868 if value is None:
   2869     return value
-> 2871 value = self.validate_elements(obj, value)
   2873 return value

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:2883, in Container.validate_elements(self, obj, value)
   2881     v = self._trait._validate(obj, v)
   2882 except TraitError as error:
-> 2883     self.error(obj, v, error)
   2884 else:
   2885     validated.append(v)

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:823, in TraitType.error(self, obj, value, error, info)
    812         else:
    813             error.args = (
    814                 "The '%s' trait contains %s which "
    815                 "expected %s, not %s."
   (...)
    821                 ),
    822             )
--> 823     raise error
    824 else:
    825     # this trait caused an error
    826     if self.name is None:
    827         # this is not the root trait

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:2881, in Container.validate_elements(self, obj, value)
   2879 for v in value:
   2880     try:
-> 2881         v = self._trait._validate(obj, v)
   2882     except TraitError as error:
   2883         self.error(obj, v, error)

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:738, in TraitType._validate(self, obj, value)
    736     return value
    737 if hasattr(self, "validate"):
--> 738     value = self.validate(obj, value)
    739 if obj._cross_validation_lock is False:
    740     value = self._cross_validate(obj, value)

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:2151, in Instance.validate(self, obj, value)
   2149     return value
   2150 else:
-> 2151     self.error(obj, value)

File ~/micromamba/envs/ipywidgets/lib/python3.11/site-packages/traitlets/traitlets.py:828, in TraitType.error(self, obj, value, error, info)
    824 else:
    825     # this trait caused an error
    826     if self.name is None:
    827         # this is not the root trait
--> 828         raise TraitError(value, info or self.info(), self)
    829     else:
    830         # this is the root trait
    831         if obj is not None:

TraitError: The 'buttons' trait of a Controller instance contains an Instance of a TypedTuple which expected a Button, not the str 'IPY_MODEL_37c4b136-efef-477f-8dd9-63168b87adba'.

Expected behavior

A working Controller() widget

Context

  • ipywidgets version: 8.0.4 but 7 has the same bug
  • Operating System and version: MacOS 13.11 but also Ubuntu 22
  • Browser and version: Version 111.0.5563.64 (Official Build) (arm64)

If using JupyterLab

  • JupyterLab version: JupyterLab v3.6.1
Installed Labextensions
jupyter labextension list                                                                                                                                                                                                                                             ✔  ipywidgets   at 12:47:55 
JupyterLab v3.6.1
/Users/thorstenbeier/micromamba/envs/ipywidgets/share/jupyter/labextensions
        jupyterlab_pygments v0.2.2 enabled OK (python, jupyterlab_pygments)
        @jupyter-widgets/jupyterlab-manager v5.0.5 enabled OK (python, jupyterlab_widgets)

adding all the outputs: ie terminal,browser, etc.. made the issue to long to submit so I removed it

@maartenbreddels
Copy link
Member

I wouldn't be surprised if https://github.com/jupyter-widgets/ipywidgets/pull/3533/files#diff-522bb5e7695975cba0199c6a3d6df5be827035f4dc18ed6da22ac216b5615c77R482
fixes this.
I think if a widget is created from the frontend, it is broken, see also ipython/ipykernel#1090

@DerThorsten
Copy link
Author

DerThorsten commented Mar 16, 2023

this indeed fixes it.

@martinRenou
Copy link
Member

Closing as fixed

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

3 participants