How To Get Python Interactive Console In Current Namespace?
I would like to have my Python code start a Python interactive console (REPL) in the middle of running code using something like code.interact(). But the console that code.interac
Solution 1:
Try:
code.interact(local=locals())
Solution 2:
Solution 3:
Another way is to start the debugger, and then run interact
:
import pdb
pdb.set_trace()
Then from the debugger:
(Pdb) help interact
interact
Start an interactive interpreter whose global namespace
contains all the (global and local) names found in the current scope.
(Pdb) interact
*interactive*
>>>
Post a Comment for "How To Get Python Interactive Console In Current Namespace?"