I like Python and I like Spyder but I find debugging with Spyder terrible!
Do you have a solution or maybe can you tell me how you debug Python scripts and functions?
I am using fresh install of Anaconda on a Windows 8.1 64bit.
Spyder's debugger is integrated with the Breakpoints pane, which lists the file, line, and condition (if any) of every breakpoint defined. To open it, select Debug ‣ List breakpoints, or press Ctrl - Shift - B ( Cmd - Shift - B on macOS).
Unfortunately, debugger speed has some runtime limitations, which can't be easily fixed. If your code does some high performance computations, Debugger will be at least 3 times slower than usual Run.
But when it comes to Python, debugging “out of the box” is a little bit cruder and primitive; single-step debugging is the main way to debug Python code, and is quite slow and clunky. It's just easier to use print statements; Python founder Guido van Rossum (reportedly) uses them for 90 percent of his debugging.
(Spyder maintainer here) After our 4.2.0 version, released in November 2020, the debugging experience in Spyder is quite good. What we provide now is what people coming from Matlab would expect from a debugger, i.e. something that works like IPython and lets you inspect and plot variables at the current breakpoint or frame.
Now about your points:
If there is a breakpoint present in the file you're trying to debug, then Spyder enters in debug mode and continues until the first breakpoint is met. If it's present in another file, then you still need to press first Debug
and then Continue
.
IPdb
is the IPython debugger console. In Spyder 4.2.0 or above it comes with code completion, syntax highlighting, history browsing of commands with the up/down arrows (separate from the IPython history), multi-line evaluation of code, and inline and interactive plots with Matplotlib.
This is fixed now. Also, to avoid clashes between Python code and Pdb commands, if you have (for instance) a variable called n
and write n
in the prompt to see its value, we will show it instead of running the n
Pdb command. To run that command instead, you have to prefix it with an exclamation mark, like this: !n
This is fixed too. You can set breakpoints in IPdb
and they will be taken into account in your current session.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With