3

I am trying to implement a VLC player control into a PyQGIS script.

There is python-vlc package that should be run with VLC Player installed. I have installed this package through OSGeo4W.bat but when I try import vlc Python says that:

specific DLL cannot be found

It's a libvlc.dll lib which is mandatory for making the VLC run in Python.

Full error code:

Traceback (most recent call last):
  File "C:\OSGEO4~1\apps\Python37\lib\code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "C:/OSGEO4~1/apps/qgis/./python\qgis\utils.py", line 798, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\vlc.py", line 220, in <module>
    dll, plugin_path  = find_lib()
  File "C:\OSGEO4~1\apps\Python37\lib\site-packages\vlc.py", line 176, in find_lib
    dll = ctypes.CDLL('.\\' + libname)
  File "C:\OSGEO4~1\apps\Python37\lib\ctypes\__init__.py", line 356, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

I looked through GIS SE, there were also cases when custom DLLs couldn't be imported through ctypes.CDLL(dll_path) nor with os.add_dll_directory(path).

Here is a similar case: Using ctypes for QGIS Python plugin to bind DLL. Unfortunately, there wasn't a solution.

Moreover, add_dll_directory() method is missing in the os module in QGIS. Has anyone also tried to add custom DLLs to PyQGIS script/plugin? What workaround can be found here?

6

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.