[Qgis-developer] Debugging Python plugin with Eclipse: breakpoints do not wotk

Francesco Sozzi fsozzi at intercad.ch
Tue Mar 25 01:39:59 PDT 2014


Hi Everybody,

I'm new on QGis developing and Python and I'm trying to setup a developing
environment for building plugins on QGis.
My problem is that breakpoints on Eclipse do not work, process does not stop
on them.

This is what I do to debug:
1) On Eclipse I execute PyDev->Start Debug Server
2) On QGis I press "Remote Debug" button
3) On Eclipse I then see, under "Debug Server [Python Server]", a new node
named "unknown"

This is what I do to setup plugin and Eclipse project:
1) on C:\Program Files\QGIS Valmiera\apps\qgis\python\plugins I've created a
folder named "MyFisrtPlugin" with all files I need for a basic test. 
   This test work fine in QGis
   Code is nested by use of TAB
2) on Eclispe I've created a new PyDev project with 
	- Directory = c:\app\Eclipse\Workspace\MyFirstPlugin
	- grammar version = 2.7
	- Interpreter = Python 2.7
	- Create links to existing sources
	- Project External Source Folders = C:\Program Files\QGIS
Valmiera\apps\qgis\python\plugins\MyFirstPlugin
	- Referenced projects = none


Here you are in detail what I've done for installing and setup:
- I use Windows 7 64 bit

- I use QGis 2.2

- I've installed PyDev on Eclipse 
	- Help->"Install new software" set "http://pydev.org/updates" and
install PyDev

- I've configured PyDev on Eclipse 
	- Windows->Preferences choose page PyDev->Interpreters->Python
Interpreter, press "new" and set
		- Python 2.7
		- C:\Program Files\QGIS Valmiera\bin\python.exe

- I've installed on QGis "Plugin reloader" and "Plugin builder"
	- Plugin->"Manage and install plugin"
	- Settings: check "show also experimental plugin"
	- search for "remote debug" and install (I did not find, check the
following section on how to install)
	- search for "plugin reloader" and install
	- search for "plugin builder" and install

- I've installed on QGis "Remote Debug" (it is not reachable by
Plugin->"Manage and install plugin")
	- download from https://github.com/sourcepole/qgis-remote-debug
	- copy RemoteDebug folder to C:\Program Files\QGIS
Valmiera\apps\qgis\python\plugins

- I've enabled Eclipse debugging:
	- create a general project
	- go to debug perspective
	- PyDev->Start debug Server
	- Open QGis and start Debug Remote
	
- I've made Eclipse understanding QGis API
	- Click Window=>Preferences=>PyDev=>Interpreter - Python
	- press "New folder" on Library tab
	- add C:\Program Files\QGIS Valmiera\apps\qgis\python		
	
- to enable pyrcc4 and pyuic4 I've set Windows system variables
	- PYTHONHOME = C:\Program Files\QGIS Valmiera\apps\Python27
	- PYTHONPATH  = C:\Program Files\QGIS Valmiera\apps\Python27\Lib


Any suggestion?...

Best regards

Franz



More information about the Qgis-developer mailing list