The Canopy editor includes a Python GUI debugger, which is available to Canopy subscribers.
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.
Enabling access to the debugger
The debugger is a premium feature of Canopy, available to commercial 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 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 firstname.lastname@example.org for manual activation credentials.
Resources for learning to use the debugger
- High-level illustrated overview of debugger purpose and features.
- "Canopy Debugger Guide" (also available offline in the Canopy Help menu’s Documentation Browser).
- Video introduction to common debugger usage scenarios:
- "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 has only limited functionality when used with a Python 3.x kernel (User Python environment) in Canopy 2.0.
- 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.)
- 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.
- Browsing of large arrays is not supported (as of Canopy 1.7, "large" means more than 1000 rows or more than 100 columns). The easiest workaround is to browse a view of a large array. The view can be created by slicing or reshaping.
- 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.