3

I'm writing a plugin for QGIS (3.10) in Python. I would like to follow the execution of the script line by line to understand some bugs. I installed Remote Debug plugin and tried to connect it with :

  • PyDev (Eclipse). I configured all as explained here: How to set up Eclipse to develop QGIS scripts or plugins. But executing the plugin in QGIS still has no effect in Eclipse.
  • Winpdb-reborn, but a window is opening in winpdpb showing the code of Remote Debug plugin and highlighting this line:

    def statusBar(self): 
        return self.iface.mainWindow().statusBar()
    
  • Eric6, and the connection seems to be OK in Eric6, but QGIS freezes as I click on "Connect" in Remote Debug.

  • First Aid plugin seems not to be compatible with QGIS 3.

I don't know in what direction to go now. Does someone have a working solution to debug plugin in QGIS 3?

3
  • 1
    I would love to be able to run a proper debugger on a python script in qgis, but what I have ended up doing is using print() statements that will end up in the python console. Crude, but it has helped me a lot of times. Commented Feb 28, 2020 at 9:08
  • That's an option, but in my case, my script creates some empty layers, and i would like to understand when. I'm not sure a print() can help. I think i really need to control the execution line by line
    – Cupain
    Commented Feb 28, 2020 at 9:13
  • Some years ago using pyCharm I got remote debugging working using this description: planet.qgis.org/planet/tag/pycharm. Don't know if it will work today.
    – Jakob
    Commented Feb 28, 2020 at 10:10

1 Answer 1

2

I recommend using First Aid Plugin for QGIS (github page). This plugin really helps with plugin testing in QGIS 3+.

1
  • 1
    I have a "Module not found error" when i try to run my script in First Aid. "No module named 'main.imported_classes'; 'main' is not a package"
    – Cupain
    Commented Feb 28, 2020 at 10:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.