having trouble with debuging QyPython plugins from Eclipse: - Win 7 x64 - QGIS 2.7 - Eclipse Luna with PyDev installed

  1. Tried to debug using Remote Debugger (http://docs.qgis.org/testing/en/docs/pyqgis_developer_cookbook/ide_debugging.html) Remote Debbuer displays "Debug Connection Failed"

  2. Tried to debug using settrace() as it is explained here: http://linfiniti.com/2011/12/remote-debugging-qgis-python-plugins-with-pydev/ Few days this approach working fine but today when I started QGIS desktop - desktop hangs on Startup Popup with "Restoring loaded plugin" status. I.e. the break point in my plugn is not hit. If I remove settracte() from code - QGIS is started OK. Looks like some break in link between QGIS and PyDev Debug Server.

I'm using Simple Test Plugin created by plugin builder. Here is the code for setrace()

import sys
from pydevd import *

FORM_CLASS, _ = uic.loadUiType(os.path.join(
    os.path.dirname(__file__), 'Test_dialog_base.ui'))

class TestDialog(QtGui.QDialog, FORM_CLASS):
    def __init__(self, parent=None):
        super(TestDialog, self).__init__(parent)
        # Set up the user interface from Designer.
        # After setupUI you can access any designer object by doing
        # self.<objectname>, and you can use autoconnect slots - see
        # http://qt-project.org/doc/qt-4.8/designer-using-a-ui-file.html
        # #widgets-and-dialogs-with-auto-connect

How do I fix this?

Windows restart does not help. Deleting .qgis2 folder does not help either.

1 Answer 1


I suggest you to add "C:/eclipse/plugins/org.python.pydev_3.9.2.201502050007/pysrc" to the pythonpath in Settings->Options->System->Envoronment".


and then call in the python console:

from pydevd import * settrace(port=5678, suspend=False)

in this way you don't have to setup the pydev connection during init of the plugin. This is executed loading first time the plugin module => hang qgis if connection is not available

In the above way, you can activate connection when you want. These steps will be available inside Remote Debug Plugin in the next release:


Now the this debug plugin use a local pydevd implementation that have to be aligned with that installed in your eclipse. so many times it does not work.

I don't know if it's polite or not, but more details will be in "Mastering QGIS" packt book available soon:


  • Thanks Luigi! Finally I was able to enable debug back by using settrace(port=5678, suspend=False) and (!!!) after re-installing PyDev plugin :) Commented Mar 2, 2015 at 21:32

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.