[Qgis-developer] [solved] DLL load failed on PyDev

Lauri Kajan lauri.kajan at gmail.com
Thu Apr 21 04:34:49 PDT 2016


Hi all,
I'll just post an answer to my own question before even asking it. I
struggled with this just too long to want anybody else to hit to the same
problem.

When trying to import qgis in Eclipse I got an error:
ImportError: DLL load failed: The specified procedure could not be found.

That was weird because I thought the environment was set up right.
The problem was that I had also C:\ProgramData\Oracle\Java\javapath in the
PATH environment variable. Do not do that it messes the Eclipse up!

Let me explain little better.
I started Eclipse with a bat file that called the o4w_env.bat and set the
PATH environment to include C:\OSGeo4W64\apps\qgis\bin. I had included
also C:\ProgramData\Oracle\Java\javapath to the PATH so Eclipse could find
javaw.exe. This javapath folder updates on every java update to include
shortcuts to the newest java install.

When running python from cmd.exe that was started with the same bat
everything worked great. I even looked dependencies of _core.pyd with
Dependency Walker and it found all the deps. Only the import inside Eclipse
didn't work.

When checking os.environ['path'] in Eclipse everything looked good and all
the necessary paths were there except it had also three extra paths in the
start of the string that I didn't set anywhere:
C:/Program Files/Java/jre1.8.0_77/bin/server
C:/Program Files/Java/jre1.8.0_77/bin
C:/Program Files/Java/jre1.8.0_77/lib/amd64
I don't know if these matter of not but import didn't work.

Finally I solved this by removing the javapath folder from the PATH and
configured the -vm in eclipse.ini to be
C:\ProgramData\Oracle\Java\javapath\javaw.exe


This is probably a bug in Eclipse or PyDev or something. Why it didn't find
dlls even when all the folders were in PATH?


Finally I can start working with my plugins which are going to be big
someday!


Hopefully someone finds this helpful.
Thanks,

-Lauri
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20160421/8b04c327/attachment.html>


More information about the Qgis-developer mailing list