10 ms·
I have been using it in an environment where I could not hook in IDE debugger but could sprinkle in breakpoint()s and rich.inspect away to my heart's content.
by VTimofeenko 5y ago
I have been using it in an environment where I could not hook in IDE debugger but could sprinkle in breakpoint()s and rich.inspect away to my heart's content.
- 0x008 5y agoWhich environment is that? So far I have been able to use a debugger everywhere. If all fails use pdb.trace()
- VTimofeenko 5y agoI had no way to punch holes through a bunch of nested ssh sessions on a tightened down production environment
- usrme 5y agoIf you're fortunate enough to use Python 3.7 or newer, then you can forego the importing of 'pdb' and using 'pdb.set_trace()' (I think you had a small omission there) in favor of just writing 'breakpoint()'[1] directly. --- [1]: https://docs.python.org/3/whatsnew/changelog.html#id325 https://docs.python.org/3/whatsnew/changelog.html#id325
- 0x008 5y agoWhat is the difference? Set trace will basically hold the code at that line (breakpoint) and drop you into the interactive debugger session. It seems like syntactic sugar. edit: but what seems like interesting concept is to overwrite sys.breakpoint_hook to start a custom debug server allowing for remote debugger attachment.