Search code examples
pythonpython-3.xmpv

Importing mpv module in my python code gives error


I was trying using the mpv bindings for python but whenevery I try execute import mpv it gives the following error:

Traceback (most recent call last):
  File "e:\Programming\Web2Desk\t1.py", line 1, in <module>
    import mpv
  File "e:\Programming\Web2Desk\mpv.py", line 566, in <module>
    _handle_func('mpv_abort_async_command',     [c_ulonglong],                              None, errcheck=None)   
  File "e:\Programming\Web2Desk\mpv.py", line 502, in _handle_func
    func = getattr(backend, name)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 387, in __getattr__
    func = self.__getitem__(name)
  File "C:\Users\PC\AppData\Local\Programs\Python\Python39\lib\ctypes\__init__.py", line 392, in __getitem__
    func = self._FuncPtr((name_or_ordinal, self))
AttributeError: function 'mpv_abort_async_command' not found

Kindly Help.


Solution

  • I got this when on an older version (0.5.2), so upgrade to the latest and it should work. I'm on 1.0.1 and it works fine.