Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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.

share|improve this question
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
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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