These are chat archives for spyder-ide/public
debugfile('path/file' wdir='path')was issued in the IPython console. Then a program listing of the first few lines, with arrow pointing to the first executable line, was output. Then there would be two
ipdb>prompts, then immediately the next IPython
In :prompt. In other words, it looked like the debugger exited immediately without a chance to issue commands.
ipdb>prompt without proceeding immediately to the IPython prompt. I'm sorry, but I don't know what Preferences I changed or how to reproduce the previous problem behavior.
len(x)instead of just
x). I realize I can evaluate
len(x)manually at the prompt, but sometimes these expressions are complex and it would be nice to see their values as they are evaluated in the code rather than retyping them manually. Any thoughts as to whether this is, or might one day, be possible?
In other words, it looked like the debugger exited immediately without a chance to issue commands.
@ydrecords This will happen if you don't have a breakpoint set on a line that runs, including on lines that aren't executable statements by themselves that the debugger can stop on (this gets a lot of people at the beginning, including me). Other than that, I'm not sure what preferences setting would control this.
What I would also like to be able to see is the evaluation of each expression in the actual code
I don't know if any standard IDE debugger offers this; this would require much more finescale control and stepping over execution. Spyder 4 will have a brand-new, heavily improved debugger that will allow you to much more easily execute arbitrary code, including individual lines/expressions, with the same flexibility as in normal Spyder as well as many other improvements.
@CAM-Gerlach thanks for the replies!
This will happen if you don't have a breakpoint set on a line that runs
I'm not sure I'm seeing that now. I have a simple file:
# -*- coding: utf-8 -*- def tester(): pass
and pressing the blue "Debug file" button with no breakpoints set results in:
> s:\projects\misc_py\untitled0.py(2)<module>() 1 # -*- coding: utf-8 -*- ----> 2 def tester(): 3 pass ipdb> ipdb>
Remaining at the
ipdb> prompt without proceeding to the IPython prompt (as was the original behavior). Is that what you expect?
What confused me about the original behavior was the program listing with arrow (implying that we were stopped at a current line before the
ipdb> prompts). In the scenario you described (running fully through the program) I would have expected no program listing and probably no prompts.
Is that what you expect?
@ydrecords If no breakpoints are set in the file you're running, Spyder stops at the first line, until you hit
continue. But if a breakpoint is set on a non-executable line, then the debugger doesn't stop and exits instead. I made this mistake myself in the beginning and it took me a while to figure it out.
if a breakpoint is set on a non-executable line, then the debugger doesn't stop and exits instead.
OK, I am able to reproduce that (by setting a breakpoint on an executable line, then commenting that line out while the breakpoint remains in place.) But in that case, I get the IPython prompt immediately (no program listing or
ipdb> prompts before returning to the IPython prompt).
If I'm ever able to reproduce the previous behavior, I'll let you know ; )