Jakub Červinka
Jakub Červinka

Reputation: 37

Can you use PyCharm's breakpoint to change local variable?

is there a way to use PyCharms advanced breakpoint abilities to change the local variable value? I know I can do that manually when the code stops at the breakpoint, but I want to do it automatically without suspending the code run.

Example: I have a code, with iDelay = 10 and in loop time.sleep(iDelay). Can I use the breakpoint like below so I don't need to wait during debugging?

this

Upvotes: 2

Views: 103

Answers (2)

Pavel Karateev
Pavel Karateev

Reputation: 8495

I guess the sane way is to add some specific debug shortcuts to your source code, e.g. in case there's a special environment variable set or something.

In the meantime you can go absolutely crazy with breakpoint conditions (or even patch the debugger Python backend, see pydevd.py path in the debug output console). For example:

enter image description here

Upvotes: 2

mcnnowak
mcnnowak

Reputation: 295

I believe that "Evaluate and Log" is only used to log runtime values. If you want to modify runtime values, that must be done manually.

Upvotes: 0

Related Questions