[Qgis-user] Error importing qgis in python

William Kyngesburye woklist at kyngchaos.com
Thu Nov 5 06:38:46 PST 2009


I believe the Python features of Qgis are supposed to be used from  
within Qgis, either in plugins or the builtin python console.  It  
certainly is compiled that way, even if it is supposed to be possible.

On Nov 5, 2009, at 8:24 AM, Daniel Arribas-Bel wrote:

> Hi All!
>
> I'm trying to import qgis into python outside the standard qgis  
> python console. I've set ht PYTHONPATH like the following:
>
> export PYTHONPATH=${PYTHONPATH}:"/Applications/qgis1.0.0.app/ 
> Contents/MacOS/share/qgis/python/"
> Then I fire up a fresh terminal, open ipython and try to import it  
> getting the following:
>
> In [3]: import qgis.core
> ---------------------------------------------------------------------------
> ImportError                               Traceback (most recent  
> call last)
>
> /Users/dreamessence/<ipython console> in <module>()
>
> ImportError: dlopen(/Applications/qgis1.0.0.app/Contents/MacOS/share/ 
> qgis/python/qgis/core.so, 2): Library not loaded: @executable_path/ 
> lib/libqgis_core.1.0.dylib
>   Referenced from: /Applications/qgis1.0.0.app/Contents/MacOS/share/ 
> qgis/python/qgis/core.so
>   Reason: image not found
>
> In [4]:
>
> Any suggestions/ideas why it's happening? How could I make it work?  
> If I'm on the python console within qgis it works fine.
>
> I'm on MacOS 10.5 and qGIS-1.0.0
>
> Thank you very much,
>
> ]d[
>
> -- 
> ============================================================
> Daniel Arribas-Bel
> Url: darribas.org
> Mail: darribas at unizar.es
>
> Department of Economic Analysis
> Universidad de Zaragoza (www.unizar.es)
>
> GeoDa Center for Geospatial Analysis and Computation (geodacenter.asu.edu 
> )
> Arizona State University (USA)
> ============================================================
>
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/qgis-user

-----
William Kyngesburye <kyngchaos*at*kyngchaos*dot*com>
http://www.kyngchaos.com/

"We are at war with them. Neither in hatred nor revenge and with no  
particular pleasure I shall kill every ___ I can until the war is  
over. That is my duty."

"Don't you even hate 'em?"

"What good would it do if I did? If all the many millions of people of  
the allied nations devoted an entire year exclusively to hating the  
____ it wouldn't kill one ___ nor shorten the war one day."

<Ha, ha> "And it might give 'em all stomach ulcers."

- Tarzan, on war




More information about the Qgis-user mailing list