pycharm not suspend when calling a function from debugger console

北慕城南 提交于 2019-12-11 01:41:53

问题


Suppose I have the following python code:

import dummy

def run():
    print('Running calc() function')
    y = dummy.perform_very_long_calculation()
    out = calc(y) #BP1 is here
    print(out)

def calc(x):
    print('Calculating ...')
    return x+2 #BP2 is here

run()

The goal is to have this flow:

  1. Put a debug break-point ("BP1") on "out = calc(y)" line.
  2. Put a debug break-point ("BP2") on "return x+2" line.
  3. Run the module and stop on this "BP1".
  4. Call calc(y) from the interactive debug console.
  5. Stop on "BP2".
  6. debug calc()
  7. goto #4 and repeat, until I am pleased with calc()

The problem: item 5 is not working. The code is not suspended on "BP2".

My motivation: I want to call calc function until it is good. This way I can dubug calc again and again without calling it through run which take 20 seconds. I am very used to this kind of debugging flow from Matlab IDE and it is very convenience.

How can I make "BP2" stop?

来源:https://stackoverflow.com/questions/36693551/pycharm-not-suspend-when-calling-a-function-from-debugger-console

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!