[Qgis-developer] Debugging QGis Python Plugins with Eclipse+Pydev

SantiagoL santiago at mailinator.com
Wed Feb 24 09:50:42 EST 2010


Hi, everybody

I've got a problem debugging QGis Python Plugins with Eclipse+Pydev. I wrote
a previous post about that, but with a different software configuration.
First of all, I will describe the new software that I've installed in my XP
machine:

1. OSGeo4W. I selected to install only the following packages:
- Desktop: qgis-unstable (because of this selection many other packages are
selected to be installed apart from qgis-unstable)
- Libs: libs selected by qgis-unstable + gdal16-ecw + gdal16-mrsid +
gdal16-python + libtiff-bin + owslib + pdflib + shapelib + qt4-devel
- Commandline_Utilities: gpsbabel + setup + shell

2. Eclipse Classic 3.5.1
3. Pydev 1.5.4

After that, I've configured PyDev in Eclipse (Window > Preferences > Pydev >
Interpreter-Python) with the python interpreter from OSGeo4W
(C\OSGeo4W\bin\python.exe) and the following environment:

a. PYTHONPATH:
	C:\OSGeo4W\bin
	C:\OSGeo4W\apps\Python25
	C:\OSGeo4W\apps\Python25\DLLs
	C:\OSGeo4W\apps\Python25\Lib
	C:\OSGeo4W\apps\Python25\Lib\site-packages
	C:\OSGeo4W\apps\Python25\sip
	C:\OSGeo4W\apps\qgis-unstable\python
	C:\eclipse\dropins\plugins\org.python.pydev.debug_1.5.4.2010011921\pysrc

b. Forced Builtins:
	PyQt4
	qgis

c. Environment variables:

- PATH:
	C:\OSGeo4W\bin;
	C:\OSGeo4W\apps\qgis-unstable\bin;
	%PATH%

- PYTHONHOME:
	C:\OSGeo4W\apps\Python25

- QT_PLUGIN_PATH:
	C:\OSGeo4W\apps\qt4\plugins

Once again, I tested the fTools Plugin as en example to debug. Also, in the
properties of the project, in PyDev-PYTHONPATH, I've added fTools and
fTools/tools folders as Source Folders.

The problem now is that every class, method,... related to PyQt4.QtCore are
not recognized. For other libraries, like PyQt4.QtGui, qgis.core,...,
everything is well recognized. One symptom is that, in Eclipse, for the
lines: "from PyQt4.QtCore import *" there is no "Unused in wild import"
warning, while it is present in every similar imports ("from <library>
import *").

Nevertheless, everything works fine when I try to debug with the
instructions given in Mauricio de Paulo's blog
(http://mauriciodepaulo.blogspot.com/2009/12/pydev-e-qgis.html).

More information: if I execute a Python shell (C\OSGeo4W\bin\python.exe)
with the same environment variables defined previously, there is no problem
with PyQt4.QtCore, every class or variables are well recognized.

So, finally, I can debug, but for PyQt4.QtCore I can´t check the code and I
don't have code completion.

May be I forgot some folder in the PATH variable or a Pydev bug?

If somebody can help me, I'd be very grateful. Regards.
      Santiago.
-- 
View this message in context: http://n2.nabble.com/PyDev-tp4219688p4626247.html
Sent from the qgis-developer mailing list archive at Nabble.com.


More information about the Qgis-developer mailing list