oaubert / python-vlc

Python vlc bindings
GNU Lesser General Public License v2.1
388 stars 111 forks source link

Program throws exception when trying to add an event callback #210

Closed Gabryx64 closed 2 years ago

Gabryx64 commented 2 years ago

Program throws "Exception function has keyword-only parameters or annotations, use inspect.signature() API which can support them" when I try to add an event callback. I fixed this by changing

if not any(getargspec(callback)[:2]):  # list(...)
            raise VLCException("%s required: %r" % ('argument', callback))

to

if not any(getfullargspec(callback)[:2]):  # list(...)
            raise VLCException("%s required: %r" % ('argument', callback))

in vlc.EventManager.event_attach()

Is there i way I could fix this without actually modifying the library?

mrJean1 commented 2 years ago

A patch is forthcoming to keep getargspec for Python 2 and use getfullargspec or signature.parameters in Python 3.

mrJean1 commented 2 years ago

Actually, the patch is already present in the generator/template/header.py and -/override.py files, see function len_args. The generated/vlc.py file needs to be regenerated.