Scripton / Docs

Debugging

Breakpoints

  • To set a breakpoint at a line, click next to it on the left margin:

  • Alternatively, you can programmatically set a breakpoint using Python's built-in breakpoint() function:

  • You can view and toggle active breakpoints in the sidebar:

Debugging

  • You can use the debug toolbar buttons (automatically shown when a breakpoint is hit) or the corresponding keyboard shortcuts to step through code while paused in the debugger —

  • The sidebar panel also allows you to navigate the callstack and view the variables for each scope —

  • You can also interact with the selected callstack frame's state in the REPL —

Postmortem Debugging

Typically, when an uncaught exception is encountered, the script terminates. Postmortem debugging offers an alternative to this. As the name implies, instead of terminating, the debugger automatically breaks at the point of exception. While the script can no longer go back to normal execution, this paused state does allow you to inspect the stack and variables, and run code in the REPL for debugging purposes.

To enable postmortem debugging, enable the Break on Uncaught Exception toggle in the Breakpoints panel:

Performance Overhead

  • Having active breakpoints incurs a performance overhead in Python. In many scenarios, this overhead may not be perceptible. However, for scenarios where performance is critical, you can quickly note when some breakpoint is active by looking for the presence of this icon in the toolbar:

  • Enabling Postmortem debugging does not incur this performance overhead.

  • There are times you may want to temporarily run a script without the breakpoint overhead. Instead of manually disabling each active breakpoint temporarily, you can use the /execute special command (default shortcut: + Shift + R). This effectively disables all breakpoints for that run.