jaseg / python-mpv

Python interface to the awesome mpv media player
https://git.jaseg.de/python-mpv.git
Other
532 stars 67 forks source link

`python-mpv` should issue a clear error report for known-incompatible libmpv versions #223

Closed SnoopJ closed 2 years ago

SnoopJ commented 2 years ago

In versions of python-mpv after v0.5.2, a libmpv older than 0.33 (API version 1.108) causes an obscure error because of a missing symbol:

$ python3 -c "import mpv"
Traceback (most recent call last):
  File "/home/snoopjedi/repos/python-mpv/mpv.py", line 579, in <module>
    _handle_func('mpv_event_to_node',           [POINTER(MpvNode), POINTER(MpvEvent)],      c_int, ec_errcheck, ctx=None)
  File "/home/snoopjedi/repos/python-mpv/mpv.py", line 502, in _handle_func
    func = getattr(backend, name)
  File "/home/snoopjedi/.pyenv/versions/3.9.4/lib/python3.9/ctypes/__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "/home/snoopjedi/.pyenv/versions/3.9.4/lib/python3.9/ctypes/__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: /lib/x86_64-linux-gnu/libmpv.so.1: undefined symbol: mpv_event_to_node

Because this symbol is introduced in libmpv 0.33 and is not optional for python-mpv, this known incompatibility can be reported more directly by telling the user that their libmpv and python-mpv are incompatible with each other.

Issues this style of minimum-API reporting can help with: #212, #131, #116, #33, #32

jaseg commented 2 years ago

That's a good idea. I wasn't aware so many people are using older libmpvs, and I seem to have caused some trouble with the latest release using these newer library symbols.