2

I have been trying to learn QGIS and I've been tasked to start with QGIS 3 so I have been going through Gary Sherman's PyQGIS Programmer's Guide.

I am currently using QGIS 2.99.0-Master, running Python 3.6.4, and am working with Script Runner 3.0.3.

I also have QGIS 2.18.15 which has Script Runner working fine. (I was midway going through an earlier edition (for QGIS 2.0) of the same guidebook before I got the newer one (for QGIS 3), which I then switched to.)

I have been trying to install ScriptRunner3 using QGIS's own plugin installer, but I keep getting some this error:

Couldn't load plugin 'scriptrunner3' due to an error when calling its classFactory() method 

ImportError: DLL load failed: The specified module could not be found. 
Traceback (most recent call last):
  File "C:/PROGRA~2/QGIS2.99/apps/qgis-dev/./python\qgis\utils.py", line 336, in startPlugin
    plugins[packageName] = package.classFactory(iface)
  File "C:/Users/zkang/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\scriptrunner3\__init__.py", line 24, in classFactory
    from .scriptrunner import ScriptRunner
  File "C:/PROGRA~2/QGIS2.99/apps/qgis-dev/./python\qgis\utils.py", line 664, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
  File "C:/Users/zkang/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\scriptrunner3\scriptrunner.py", line 27, in 
    import win32api
  File "C:/PROGRA~2/QGIS2.99/apps/qgis-dev/./python\qgis\utils.py", line 664, in _import
    mod = _builtin_import(name, globals, locals, fromlist, level)
ImportError: DLL load failed: The specified module could not be found.


Python version: 3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 07:18:10) [MSC v.1900 32 bit (Intel)] 
QGIS version: 2.99.0-Master Master, b6ad920404 

Python Path:
C:/PROGRA~2/QGIS2.99/apps/qgis-dev/./python
C:/Users/zkang/AppData/Roaming/QGIS/QGIS3\profiles\default/python
C:/Users/zkang/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins
C:/PROGRA~2/QGIS2.99/apps/qgis-dev/./python/plugins
C:\Program Files (x86)\Python36-32\Lib\site-packages\win32
C:\Program Files (x86)\QGIS2.99\bin\python36.zip
C:\PROGRA~2\QGIS2.99\apps\Python36\DLLs
C:\PROGRA~2\QGIS2.99\apps\Python36\lib
C:\Program Files (x86)\QGIS2.99\bin
C:\PROGRA~2\QGIS2.99\apps\Python36
C:\PROGRA~2\QGIS2.99\apps\Python36\lib\site-packages
C:/Users/zkang/AppData/Roaming/QGIS/QGIS3\profiles\default/python

It might be worth to note that there was a previous error, where QGIS could not find win32.api (despite me having installed it already) and I had to append the PYTHONPATH environment variable to get around that. So the error at hand might just be very bad installation on my part.

0

The win32api module isn't included with python3 or with the QGIS installer.

You can install it using:

python3 -m pip install pywin32

If you need help setting up your command line environment on windows, see: http://spatialgalaxy.net/2018/02/13/quick-guide-to-getting-started-with-pyqgis3-on-windows

I've added a warning about the requirement in the latest version (3.0.4).

  • Version 3.0.5 of ScriptRunner attempts to do the install for you if win32api is missing. – gsherman Mar 1 '18 at 19:03

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.