I am completely new to the python world and I am trying to set up PyDev in Eclipse (windows) so I can access QuantumGIS (Qgis) and gdal libraries also included in the Qgis distribution. I would appreciate any help since I am a bit lost after several trials.
The problem is that when I tried to set up the python interpreter to the one included \Quantum GIS Wroclaw\bin I get the following error:
See error log for details.
No output was in the standard output when trying to create the interpreter info.
The error output contains:>>'import site' failed; use -v for traceback
Traceback (most recent call last):
File "C:\Archivos de programa\Eclipse\plugins\org.python.pydev_188.8.131.521121518\PySrc\interpreterInfo.py", line 15, in <module>
ImportError: No module named os
My version of Qg is 1.7.3. I do not understand this since PyDev should be compatible with python version from 2.1 and I think the one provided by Qg is 2.5.
I tried to overcome this problem by using python 3.2 but still it does not find the classes. With this interpreter the PYTHONPATH is:
\Program Archives\Quantum Gis Wroclaw\apps\qgis\phython
\Program Archives\Quantum Gis Wroclaw\apps\qgis\apps\Qt4
\Program Archives\Quantum Gis Wroclaw\apps\qgis\python\plugins
Thanks a lot in advance. Hope someone can give a clue.
If QGis is based on Python 2.5, you should definitely not try to use Python 3.2 to access its libraries (Python 3.x is in no ways backward compatible to Python 2.x).
So, before attempting to configure it within Eclipse, I'd advise to get it working in a shell so that you know which paths would need to be in the PYTHONPATH.
I must say I'm not familiar with QGis, so, it'd be useful if you provide a dir of what's below the \Quantum GIS Wroclaw\ install (basically the directory structure, stating which directory contain __init__.py files and which directories contain other python files - especially the ones you want to import).
You can try starting a python interpreter in the command line then doing the import you want (i.e.: say import foo), then, add a folder you 'd expect to be in the PYTHONPATH - in your case something as sys.path.append("\Program Archives\Quantum Gis Wroclaw\apps\qgis\python\plugins") and try to do the "import foo" again until you're able to find which should be the PATHS that are added to the PYTHONPATH.
Note that on some programs, you can't really access its libraries from outside of the program, only when running inside it (because it needs an environment setup - there's an ebook explaining how to setup for blender in PyDev: http://airplanes3d.net/pydev-000_e.xml so, it might be worth taking a look at it if QGIS itself has that limitation on its libraries).
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.