Debugging session example

Here, we will show how to debug the TestPlugin remotely. We'll also learn how to insert a code breakpoint, stop executions, and show variable values during executions. The steps to follow are:

  1. Create a PyDev project that points to the source code of the TestPlugin.
  2. Add a breakpoint to the TestPlugin run() function in the Aptana Debug perspective.
  3. Start the PyDev Debug server.
  4. Connect to the PyDev server from QGIS.
  5. Run the plugin.
  6. Explore the variable values.
  7. Continue the execution of the plugin.

Creating a PyDev project for TestPlugin

To be able to add code breakpoints, it's necessary to load test_plugin.py. This can be simply opened as a file, but it's better to learn how to view the entire plugin as a PyDev project. This allows ...

Get Mastering QGIS - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.