3

I am trying to access and use QGIS modules/class/methods from IDLE on a mac. I have had the same problem as a few other people, and browsing the forums have tried to follow the advice they have been given.

when typing:

import qgis.core

I receive the msg:

ImportError: No module named core

I have tried to set path settings as follows:

export PYTHONPATH=/Applications/QGIS.app/share/python

and

export LD_LIBRARY_PATH=/Applications/QGIS.app/lib

but I am very new to using command line for the mac and also to python.

I have now spent a couple of hours searching for others' answers that could hopefully help me, but now I am giving up and asking for advice.

mgri
  • 16,159
  • 6
  • 47
  • 80
Becky
  • 627
  • 2
  • 6
  • 16
  • Have you checked http://gis.stackexchange.com/questions/30068/importing-qgis-core-into-python-on-osx – underdark Aug 01 '12 at 11:08
  • yes, I checked this topic and it hasn't helped - I used the different PYTHONPATH and LD_LIBRARY_PATH that he/she uses but it makes no difference. also - i'm using python 2.7.3 whereas he/she is on 2.3? – Becky Aug 01 '12 at 11:17
  • Can you show the content of the applicable directories? Something like "ls -l $PYTHONPATH" and "ls -l $LD_LIBRARY_PATH" may help – BradHards Aug 01 '12 at 11:24
  • visit060: ls -l $PYTHONPATH total 544 drwxr-xr-x 19 root admin 646 20 Mar 14:23 PyQt4 drwxr-xr-x 7 root admin 238 21 Feb 04:08 plugins drwxr-xr-x 11 root admin 374 21 Feb 04:08 qgis -rwxr-xr-x 1 root admin 107468 11 Feb 20:13 sip.so -rw-r--r-- 1 root admin 91059 11 Feb 20:13 sipconfig.py -rw-r--r-- 1 root admin 72261 20 Mar 14:23 sipconfig.pyc visit060:applications ls -l $LD_LIBRARY_PATH ls: /home/applications/qgis/lib: No such file or directory – Becky Aug 01 '12 at 11:38
  • which suggests I don't have the right file (library file) - how would i get this? ...absolutely no clue about this stuff – Becky Aug 01 '12 at 11:38
  • That suggests that LD_LIBRARY_PATH isn't set to the right value (you can see what it equals with something like "echo $LD_LIBRARY_PATH". You wanted "/Applications/QGIS.app/lib" but appear to have "/home/applications/qgis/lib". How are you setting this environment variable? Is something updating it later? – BradHards Aug 01 '12 at 21:07

0 Answers0