DataSpell 2024.3 Help

Debug Python code

Starting a debugger session is very similar to running the program in normal mode. The debugger is attached behind the scenes, so you don't have to configure anything specific to start a debugger session. If you are able to run your program from DataSpell, you will also be able to debug it using the same configuration.

  • Press Ctrl + D (macOS) or Shift + F9 (Windows, Linux).

    This will create a temporary run/debug configuration for you. After that, you can customize and save this temporary configuration if needed. This is the quickest way to debug your program without configuring the startup parameters.

  • Click the Debug icon (Debug Python code) on the Python editor toolbar.

    Launch debugger

Pause/Resume a debugger session

When the debugger session is running, you can pause/resume it using the buttons on the toolbar of the Debug tool window:

  • To pause a debugger session, click the Pause button.

  • To resume a debugger session, click the Resume button F9.

Terminate a debugger session

  • Click the Stop button in the Debug tool window.

    Alternatively, press Ctrl+F2 and select the process to terminate (if there are two or more of them).

Productivity tips

Debug non-responding applications

In case your application hangs, it may help to pause the session and let the debugger get the information about the application's current state. You can then use this information to locate the cause of the problem.

Use Pause Program instead of breakpoints

If you used Pause Program instead of a breakpoint, some features, such as evaluate expression will be unavailable. However, you can work around this limitation by stepping a line further. After this, you will be able to use the debugger as if you had stopped at a breakpoint.

Last modified: 14 November 2024