Svoboda | Graniru | BBC Russia | Golosameriki | Facebook
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

ControllerManager crashes #995

Closed
hdelrio opened this issue Nov 12, 2023 · 1 comment
Closed

ControllerManager crashes #995

hdelrio opened this issue Nov 12, 2023 · 1 comment
Labels
bug Something isn't working

Comments

@hdelrio
Copy link

hdelrio commented Nov 12, 2023

BUG DESCRIPTION
ControllerManager crashes

SYSTEM INFORMATION
MacBook Pro 2017, it has a TouchBar
MacOS Ventura 13.6.1
python 3.11.6
pyglet 2.0.10

HOW TO REPRODUCE
import pyglet

pyglet.input.ControllerManager()

ERROR PRODUCED
Traceback (most recent call last):
File "", line 1, in
File "/Volumes/WIP/conda/cs212/lib/python3.11/site-packages/pyglet/input/macos/darwin_hid.py", line 587, in init
if controller := _create_controller(device, display):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Volumes/WIP/conda/cs212/lib/python3.11/site-packages/pyglet/input/macos/darwin_hid.py", line 624, in _create_controller
if not device.transport and device.transport.upper() in ('USB', 'BLUETOOTH'):
^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'upper'

EXPLANATION
This line does not make sense since if the device has no attribute named transport (not device.transport) it will attempt to call the method upper() on a NoneType. In my case the device that it is causing the problem u=is HIDDevice(name=TouchBarUserDevice), since this device does not have a property named transport.

HOW TO FIX
line 624 in darwin_hid.py needs to be changed
FROM
if not device.transport and device.transport.upper() in ('USB', 'BLUETOOTH'):
TO
if not (device.transport and device.transport.upper() in ('USB', 'BLUETOOTH')):

@hdelrio hdelrio added the bug Something isn't working label Nov 12, 2023
@benmoran56
Copy link
Member

Thanks for opening the ticket. I just pushed a similar fix to the master branch, which will be in the next point release.

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