Qgis Debugging?

Discussion of plugin development

Qgis Debugging?

Postby MSGettingCrazy on Wed Jul 28, 2010 8:33 pm

Hello,

i think a have a general problem with the procedure of debugging a python plugin in QGIS. I just started two weeks ago to write plugins... so there are a lot of question marks!

I read http://www.reprojected.com/geoblog/2009/02/06/debugging-qgis-plugins/ on Aarons blog. Out of that i think debugging is just in the console possible? With pdb? I am used to Visual Studio, so ... it's very difficult for me to understand the black and white of the console. i just tried to work with the code from Aaron. I ran QGIS and it stopped on the point i wanted it to stop, but just with the information that the global name QtCore is not defined?! So i think i have a problem with the general procedure...

It would be great if there is a possibility to debug with eric4... Is there a possibility?

I have another question:
Is it possible to debug without building from source?
I read the article: http://www.qgis.org/wiki/How_to_debug_QGIS_Plugins, but it's not updated. so ./configure --enable debug is not working. I have to admit, that i haven't build my qgis from source, so i know pretty nothing about that. I just tried and had to stop after i couldn't find the configure file. Do i have to do the configuration with cmake?
MSGettingCrazy
Newbie
Newbie
 
Posts: 5
Joined: Mon Jul 19, 2010 2:13 pm

Re: Qgis Debugging?

Postby Beynor on Wed Jul 28, 2010 10:20 pm

Hi,

I can't help too much with eric4 issue. I've just used IDLE and the console so far.

Use

from PyQt4.QtCore import *
from PyQt4.QtGui import *
from qgis.core import *
from qgis.gui import *

to import all the components of QTCore and the other needed modules, rather than 'from PyQT4 import QTCore' which just imports the main module. (Not sure if I'm using the correct terminology... any experts out there please correct me.) My module didn't work until I imported it this way.

Sorr I couldn't help more.
Beynor
Technician
Technician
 
Posts: 32
Joined: Thu Oct 29, 2009 11:35 pm

Re: Qgis Debugging?

Postby peppo on Fri Aug 13, 2010 7:22 am

Hello MSGettingCrazy,

Is it possible to debug without building from source?

Yes, it is possible to debug python plugins without building QGIS from source.

I have not used eric4 but it probably works pretty much the same.
Make sure to use the python and other libs from OSGeo4W, in case your OS is Windows.

Then just add the lines
import pydevd
pydevd.settrace()
e.g. when your plugin loads. QGIS will stop on any breakpoints if your IDE works correctly.

See the first message of http://forum.qgis.org/viewtopic.php?f=5&t=6225 on how to set some path variables, in case your OS is Windows.

Regards
peppo
Newbie
Newbie
 
Posts: 7
Joined: Wed Jun 16, 2010 8:41 am


Return to Plugins

Who is online

Users browsing this forum: Google [Bot] and 2 guests

cron