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

Connecting a Krom (xbox 360-style controller) controller mid-game crashes pygame. #3225

Closed
willhlm opened this issue Nov 17, 2024 · 2 comments
Labels
bug Not working as intended

Comments

@willhlm
Copy link

willhlm commented Nov 17, 2024

Hi, I'm developing a game where I want to use a controller. Actually using the controller works fine, however, connecting the controller via USB while the game is running crashes the game with the error below. Disconnecting during gameplay doesn't cause any crash. Connecting with USB prior to running the game works fine, and the controller can be used as intended. Error:

KeyError: 0

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\willi\Desktop\Code\Games\happy_ville\game.py", line 78, in
g.run()
File "C:\Users\willi\Desktop\Code\Games\happy_ville\game.py", line 55, in run
self.event_loop()
File "C:\Users\willi\Desktop\Code\Games\happy_ville\game.py", line 34, in event_loop
events = pygame.event.get()
^^^^^^^^^^^^^^^^^^
SystemError: returned a result with an exception set

Using a "krom key pro gaming wired gamepad" (Model: NXKROMKEY). Same button and joystick layout as a xbox 360 controller.

Current environment:
pygame-ce 2.2.1 (SDL 2.26.4, Python 3.11.9)
Platform: Windows-10-10.0.22631-SP0
System: Windows
System Version: 10.0.22631
Processor: AMD64 Family 25 Model 80 Stepping 0, AuthenticAMD
Architecture: Bits: 64bit Linkage: WindowsPE
Driver: Display Not Initialized

Python: CPython
pygame version: 2.2.1
python version: 3.11.9

SDL versions: Linked: 2.26.4 Compiled: 2.26.4
SDL Mixer versions: Linked: 2.6.3 Compiled: 2.6.3
SDL Font versions: Linked: 2.20.2 Compiled: 2.20.2
SDL Image versions: Linked: 2.0.5 Compiled: 2.0.5
Freetype versions: Linked: 2.11.1 Compiled: 2.11.1

Any help would be much appreciated.

@willhlm willhlm added the bug Not working as intended label Nov 17, 2024
@oddbookworm
Copy link
Member

Try updating your pygame-ce version to the latest release and let us know if it’s still a problem

@willhlm
Copy link
Author

willhlm commented Nov 17, 2024

Yea that solved it! That's a bit embarrassing hehe. Thanks a lot :)

@willhlm willhlm closed this as completed Nov 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Not working as intended
Projects
None yet
Development

No branches or pull requests

2 participants