inputs icon indicating copy to clipboard operation
inputs copied to clipboard

NameError: global name 'XINPUT_ERROR_SUCCESS' is not defined

Open Fuzzyma opened this issue 9 years ago • 4 comments

First of all: Great thx for this lib. It just works and is so easy to use. Thank you!

When I ran my program a while, I suddenly got this error:

NameError: global name 'XINPUT_ERROR_SUCCESS' is not defined

Since it happened out of nowhere I cant give you a debugging hint. I run this lib on win7 with XBox One Controllers (works like a charm!)

Full traceback:

    events = get_gamepad()
  File "C:\Anaconda2\lib\site-packages\inputs.py", line 2713, in get_gamepad
    return gamepad.read()
  File "C:\Anaconda2\lib\site-packages\inputs.py", line 2101, in read
    return next(iter(self))
  File "C:\Anaconda2\lib\site-packages\inputs.py", line 2192, in __iter__
    self.__check_state()
  File "C:\Anaconda2\lib\site-packages\inputs.py", line 2199, in __check_state
    state = self.__read_device()
  File "C:\Anaconda2\lib\site-packages\inputs.py", line 2406, in __read_device
    if res == XINPUT_ERROR_SUCCESS:
NameError: global name 'XINPUT_ERROR_SUCCESS' is not defined
Segmentation fault

Fuzzyma avatar Sep 22 '16 12:09 Fuzzyma

Sorry for the delay in replying. Thanks so much for logging the error. XINPUT_ERROR_SUCCESS = 0 which is defined at line 139.

Therefore, on line 2406, it could just be replaced with if res == 0. When I get a chance to spool up Windows I will test and try to make the same error, and see if this fixes it.

zeth avatar Oct 06 '16 12:10 zeth

Sounds good. Thank you!

Fuzzyma avatar Oct 06 '16 15:10 Fuzzyma

Wow time flew. Sadly I cannot replicate this error. Can you?

zeth avatar Jul 22 '18 12:07 zeth

Nope - This is 2 years old. I have no idea what that was :)

Fuzzyma avatar Jul 22 '18 18:07 Fuzzyma