I am working on Python plugins for QGIS. I set my variables as

PATH :=C:\OSGeo4W\apps\qgis;%PATH% PYTHONPATH:=C:\OSGeo4W\apps\qgis\python

But when I try to run my .py file in IDLE I get an error saying:

Traceback (most recent call last):

File "C:\rt_sql_layer_working\DlgQueryBuilder.py", line 30, in from qgis.core import * ImportError: DLL load failed: The specified module could not be found.

What should I set for the PATH variable??

  • Have you/is the dll registered?
    – Hairy
    Jan 25 '12 at 11:06

OK, looking at this logically, I would say you are missing a dll, or one is not registered. From our good friends over at stackoverflow, I have found using Dependency Walker as good a utility as you can find for working out precisely what your project is using, and, more importantly, what it wants to use and cannot find.

Run it and look at the outputs. If it still doesn't make sense, post the results here and we can look at them. It will be a missing/unregistered dll, if I were a gambling man.

  • 1
    ok..actually its a mistmatch between the versions..i gets this error for from qgis.core import * that: RuntimeError: the PyQt4.QtCore module is version 1 but the qgis.core module requires version -1
    – PNM
    Jan 25 '12 at 12:05
  • 1
    This appears to be a bug - Can you post the full trace?
    – Hairy
    Jan 25 '12 at 13:04

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.