{"repo":"cknd/stackprinter","free":true,"listed":false,"github":"https://github.com/cknd/stackprinter","clone":"git clone https://github.com/cknd/stackprinter.git","description":"Debugging-friendly exceptions for Python","language":"Python","stars":1299,"topics":["python","error-logging","debugging"],"license":"MIT","category":"dev-tools","readme_excerpt":"Better tracebacks This is a more helpful version of Python's built-in exception message: It shows more code context and the current values of nearby variables. That answers many of the questions I'd ask an interactive debugger: Where in the code was the crash, what's in the relevant variables, and why was that function called with those arguments. It either prints to the console or gives you a string for logging. Before After I rarely use this locally instead of a real debugger, but it helps me sleep when my code runs somewhere where the only debug tool is a log file (though it's not a fully-grown error monitoring system). By default, it tries to be somewhat polite about screen space, showing only a few source lines & the function header, and only the variables that appear in those lines , and using only (?) 500 characters per variable. You can configure exactly how verbose things should be. It outputs plain text normally, which is good for log files. There's also a color mode for some reason 🌈, with a few different color schemes for light and dark backgrounds. (The colors track different variables instead of the language syntax.) Usage Option 1: Set and forget To replace the default python crash printout, call set excepthook() somewhere once. Afterwards, any uncaught exception will be printed with an extended traceback (to stderr, by default). You could also make this permanent for your python installation. Option 2: Call it selectively during exception handling For more co","default_branch":null,"files":null,"tree":[],"storefront":"/r/cknd","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/cknd/stackprinter/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}