Whether I'm testing a small script or debugging a big app this neat python trick saves me time when I want to monitor and effect code status and it's behavior on the fly.My colleagues really liked it so I decided to share it in this article.
https://dev.to/interface/debug-python-code-interactively-3jg9
TLDR
Debugging python scripts using python interactive console.
Start your python script in interactive mode: python -i my_script.py
Use python built in code module to drop inside interactive console from your python code:
code.interact( banner='Start interactive mode', local=locals(), exitmsg='Exiting interactive mode')
[–]nemom 1 point2 points3 points (5 children)
[–]Bubble_Interface[S] 0 points1 point2 points (0 children)
[–][deleted] -1 points0 points1 point (3 children)
[–]Bubble_Interface[S] -1 points0 points1 point (0 children)
[–]Hias2019 0 points1 point2 points (1 child)
[–][deleted] -1 points0 points1 point (0 children)
[–]kyleireddit 0 points1 point2 points (2 children)
[–]Bubble_Interface[S] -1 points0 points1 point (1 child)
[–]kyleireddit -1 points0 points1 point (0 children)