I code in Python and I my workflow uses debuggers (I coded for 8 years in Matlab).

I develop numerical simulation codes: most of the time it returns a result, the question is: "Is the result right?"

Consequently, I use the debugger to track constantly variables' content.

Here is my workflow:

  1. I code a bunch of lines
  2. M-x realgud:ipdb RET the_name_of_the_file_i_want_to_debug RET
  3. I set one breakpoint in a tricky part of the code I want to inspect
  4. M-x isend-associate RET *ipdb thefile shell* RET
  5. I test the lines I feel might be wrong: M-x isend-mode RET C-RET (on the line I want to test in the interpreter)
  6. I find the mistake and the right code, I change the file: C-x C-q (this command leave at the same time the read-only-mode and the single keystroke mode of realGUD), I modify the code, save C-x C-s
  7. I go back in realGUD activating again the single keystroke: C-x C-a C-q (all the breakpoints are still present)
  8. I restart the debugging process: r
  9. I check and continue to debug other parts of the code.

I have one general question, and 3 technical questions:

general question: What do you think of this workflow, how would you optimize it?

technical questions: I am on Mac OS X 10.11, using emacs 25.3 (9.0), and ipython 6.2.1, consequently I need to pass the argument --simple-prompt to IPython to make it work. I think, it creates these problems:

  1. I cannot use isend with a python line distributed on several lines (long command), so I had to turn off the auto-fill-mode,
  2. I cannot use completion on defined variables (a HUGE drawback): lets say I define oiseau = "bird" in a previous part of the code, then the ipdb debugger opened by realGUD does not let me complete if I type: oise + TAB

the last technical question:

  1. debugging pyQt when creating GUI does not seem to work (not central in my work but still disappointing...)
  • I have the answer to the first technical question... ipdb cannot manage multi-line statements. but there is a very simple way to do that: type interact in the ipdb debugger and it launches inside ipdb an IPython with all the local variables! – Robin Tournemenne Mar 21 '18 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.