Skip to content

Clear bug in uinput.py? Missing argument on os.strerror() #135

Description

@sequoia-hope

I am trying to create a custom force feedback device.

Something isn't working right, and so input tries to throw an error with this line:

raise UInputError('Failed to begin uinput erase: ' + os.strerror())

Except that line seems to have a bug. Instead of throwing UInputError it throws:
TypeError: strerror() takes exactly one argument (0 given)

It looks like the return code from line 245 needs to be stored. So instead of:

if self.dll._uinput_begin_upload(self.fd, ctypes.byref(upload)):
            raise UInputError('Failed to begin uinput upload: ' + os.strerror())

You might want:

ret = self.dll._uinput_begin_upload(self.fd, ctypes.byref(upload))
if ret:
            raise UInputError('Failed to begin uinput upload: ' + os.strerror(ret))

Or am I missing something? If it is an error and I can help with a pull request please let me know!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions