when I try to import qgis core module from python:
from qgis.core import *
I get this error:
ImportError: DLL load failed: The operating system cannot run %1.

Searching the web I found that I need to point my PATH to the qgis installation, so I did that:
set PATH=C:\OSGeo4Windows\apps\qgis-dev\;%PATH%

But I still get the error.

obs, i'm using: Osgeo4w Qgis 1.7, Windows 7, Aptana Studio 3 with Pydev.

  • 1
    Are you using the osgeo4w bundled python or do you have a separate python installation on your system? – underdark May 24 '11 at 17:44
  • I'm using a separate python 2.7. – Pablo May 24 '11 at 20:45
  • 1
    I don't think it's possible to use python 2.7 with QGIS. Using the osgeo4w python should fix your problem. – underdark May 24 '11 at 21:23
  • 1
    I'm pretty sure you have to use the version of Python that QGIS is complied with. – Nathan W May 24 '11 at 22:35
  • True, I've changed the interpreter in Pydev to the osgeo4w python and it moved to a new error: DLL load failed with error code 182. In the internet it says it's something related to SVN and Apache. I'll try a few more things here... thanks. – Pablo May 25 '11 at 14:10

Eclipse with Pydev requires a few more things in order to work with OSGeo4w based python. The following link has good examples, update version numbers as appropriate. http://lists.osgeo.org/pipermail/qgis-developer/2010-February/009182.html

FYI, OSGeo4w now ships python 2.7 but you still need to use the OSGeo4w python in order to be able to import qgis modules. There is one quirk (Bug) with pydev, where you need to have a regular python install of the same version on the machine in order to pick the OSGeo4w python in the Pydev interpreter settings.

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.