Using Canopy's interactive Python debugger and variable browser

(Updated "Known Issues", August 26, 2016)

Beginning with Canopy 1.5, the Canopy editor includes a Python GUI debugger, which is available to Canopy subscribers (commercial and academic).

The Canopy debugger is tightly integrated with IPython’s debugger, and adds GUI tools for stepping through code and setting breakpoints.

It also provides a variable browser, which makes it quick and easy to inspect variables in the current Python namespace, including complex objects such as NumPy arrays.

Downloading Canopy

Canopy users - please note that updating from Canopy 1.5.1 or earlier is not available from within Canopy: For details, please see this article.

Enabling access to the debugger

The debugger is a premium feature of Canopy, available to commercial and academic subscribers. When you log in to Canopy's Welcome screen (or restart an already-logged-in Canopy while an internet connection is available), your subscription will be validated on Canopy's servers, and the debugger will be activated. The activation will remain in effect until your subscription expires, even when you don't have internet connectivity.

If you access the internet through a proxy firewall, you will need to explicitly configure your proxy in Canopy's preferences dialog. For more details, see "Can I use Canopy Behind a Proxy Firewall?".

For commercial or group academic (not individual academic) subscribers who can never gain access to the Canopy servers online (typically on machines which are disconnected, or are behind a stringent firewall or a proxy not yet supported by Canopy), please contact us at canopy.support@enthought.com for manual activation credentials.

Resources for learning to use the debugger

FAQs

  • "Step Over" - The name of this action can be confusing at first. Perhaps it would better have be named "Step flat" or "Step at this level" or simply "Step", but for better or worse, "Step Over" is the name that is now pervasive in the software industry. "Step Over" does not ignore or skip the next statement. Rather, it executes the next statement as a whole, rather than stepping into the implementation of that statement (e.g. into a called function). It then stops at the next statement at the same level.
  • "Step Into" an import statement - It may appear that the debugger does not single-step into import statements. Actually, this appearance happens because if a module has already been imported, then the import statement reduces to an assignment (adding a reference, in the current module namespace, to that already existing imported module object). So there's nothing to single-step into.

Known issues with the debugger

  • The debugger allows you to set a breakpoint on a comment or a blank line, but does not actually stop there. Fixed in Canopy 1.7.3.
  • The debugger allows you to set a breakpoint on a "pass" statement, but is not consistent about whether it will stop there. (This reflects an underlying ipython issue.)
  • "Step into" a decorated function sometimes fails. Fixed in Canopy 1.5.3. 
  • Auto-debug (new feature in Canopy 1.7) can debug at breakpoints, but not at exceptions.
  • When auto-debug mode is on, all ipython magic commands must begin with "%" (otherwise they are not recognized as magic commands).
  • Click-into browsing is not yet supported for nested objects other than lists, tuples, 1D- and 2D-arrays, or dicts. Please directly enter into the variable browser, the name of the nested object that you wish to inspect or edit.
  • Debugging multiple threads is not yet supported.
  • Breakpoints set in a class inheriting HasTraits are not executed in Canopy's debugger when .configure_traits() is called.
  • When debugging a GUI application, it may be necessary to disable PyLab mode in Canopy's Preference dialog (Python tab), so that the application runs in its own event loop rather than in IPython's.
  • (See FAQ above) The debugger does not single-step into import statements..

Please do not enter support requests in article comments

Please use article comments for suggestions to improve the article. For individual support requests, please follow these guidelines.

Have more questions? Submit a request

Comments

Powered by Zendesk