The Canopy editor includes a Python GUI debugger, which is available to Canopy users who have logged in from the Canopy Welcome Screen.
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 Canopy debugger is available all Canopy users who have logged into Canopy on the Welcome Screen. To authenticate your debugger access initially, you may need to log in again or restart Canopy while net-connected. If you subsequently go offline, you can continue using the debugger.
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
- Auto-debug (the toolbar icon that looks like a red filled-in circle surrounded by rings of white and black) should normally be disabled. It can interfere with normal debugging, including causing freezes.
- Auto-debug 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).
- For more about auto-debugging, see Debugger Toolbar.
- 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.)
- Breakpoints set in a class inheriting HasTraits are not executed in Canopy's debugger when .configure_traits() is called.
- 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.
- 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.
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.