Pyringe will do what you want.
Just grab it and run python -m pyringe
, then you should be able to inject it in and debug like you wanted.
题
Python infinite loop code below:
i = 0
while True:
i = i + 1
I know I can use import IPython; IPython.embed(
) or import pdb; pdb.set_trace()
to pause loop running and get value of i --- run-time debug.
however, what I want is if I can "tapping" into this loop on demand probe value without pause it, similar to sniffer packets in network area?
PS: not as simple as print i
to terminal directly.
Thanks.
解决方案
Pyringe will do what you want.
Just grab it and run python -m pyringe
, then you should be able to inject it in and debug like you wanted.