Stop at the line where a variable gets changed

前端 未结 2 720
不知归路
不知归路 2020-12-10 11:16

I am trying to track down when a variable gets updated. I have a watcher, but is there any way to set it up so that the execution can be paused when the value is getting upd

相关标签:
2条回答
  • 2020-12-10 11:36

    You can add a breakpoint in the line you need to watch and right-click it. Then in the dialog box you have "condition" as last input: add a condition that uses the variable you need and it should stop when you set it to.

    0 讨论(0)
  • 2020-12-10 11:43

    Currently pycharm does not have a default built-in feature that tracks variable modification in real time. Alternatively you can do this:

    1. run debug
    2. From debugger pane -> Variables, right click the variable you would like to track and and add it to Watches.
    3. In Watches pane, right click the variable and select referring objects.

    The feature you are talking about is, I believe, called watchpoint support and according to this article: http://sourceforge.net/blog/watchpoints-in-python/ Eric and PyScriptor has the feature but not pycharm.

    0 讨论(0)
提交回复
热议问题