These are chat archives for spyder-ide/public

29th
Apr 2019
M Powers
@ydrecords
Apr 29 04:57
@CAM-Gerlach thanks for the reply. My initial problem has now been sorted, but here is the description if you are interested. I was trying to work with the interactive debugger in the IPython console. The exact step I tried was to press the blue "Debug file" button. The behavior I received was that the command 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 [10]: prompt. In other words, it looked like the debugger exited immediately without a chance to issue commands.
This happened consistently across a number of files for a number of months. However, after initially posting here I poked around with a number of Preferences settings, and now I do get an interactive 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.
M Powers
@ydrecords
Apr 29 05:04
Now my question is the following (although I think it is probably a pdb question rather than Spyter): I see variable values in the Variable Explorer at various breakpoints. What I would also like to be able to see is the evaluation of each expression in the actual code (e.g. 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?
ok97465
@ok97465
Apr 29 13:14
Is "New Window" of editor working in lastest master?
CAM Gerlach
@CAM-Gerlach
Apr 29 15:32
@ok97465 Nope, I can repro the bug. Thanks for reporting; opened as spyder-ide/spyder#9236 .
CAM Gerlach
@CAM-Gerlach
Apr 29 15:39

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.

M Powers
@ydrecords
Apr 29 15:57

@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.

M Powers
@ydrecords
Apr 29 16:07
Thanks for the description of the upcoming Spyder 4 features, I'll look forward to those!
CAM Gerlach
@CAM-Gerlach
Apr 29 16:09

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.

M Powers
@ydrecords
Apr 29 16:21

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 ; )

CAM Gerlach
@CAM-Gerlach
Apr 29 16:30
Okay, thanks!