2

I'm trying to build a Python plugin in QGIS which does some raster image processing. The processing itself is done via a .dll. Hence, I'd like to bind it with ctypes. First of all: is it possible to use ctypes with a Python plugin in QGIS? Secondly, if yes, what am I doing wrong if I am getting the following error?

enter image description here

OSError: [WinError 126] The specified modul could not be found

The plugin was created using the plugin builder and following this tutorial. It's a dock widget and is besides the processing function vanilla.

What I tried so far:

  • Checked if the .dll exists in the specified location
  • Ran a mwe only loading the dll and doing the processing in both a conda environment and using the Python executable in c:\Program Files\QGIS 3.14\apps\Python37\ -> Both worked without problems
  • Used os.chdir and changed to directory where the .dll is located -> No effect
  • Tried different things with the directory string (raw, forward slash, double backward slash)
  • Added the directory containing the dll to the Windows PATH

I've read that it could be related to a missing dependency. However, I'm not sure how to pin-point the problem as it seems to run in both tested Python environments.

1
  • I've sometimes had issues with certain programs not working from inside of QGIS due its environmental variables interfering somehow (as far as I can tell). See e.g.: gis.stackexchange.com/questions/380049/… If you export from within QGIS the state of the environmental variables, then set them externally, then start the QGIS Python3.7 exe as you mentioned, does it run, or not? May 5 '21 at 22:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.