user-experience

Hide traceback unless a debug flag is set

Hide traceback unless a debug flag is set Question: What is the idiomatic python way to hide traceback errors unless a verbose or debug flag is set? Example code: their_md5 = ‘c38f03d2b7160f891fc36ec776ca4685’ my_md5 = ‘c64e53bbb108a1c65e31eb4d1bb8e3b7’ if their_md5 != my_md5: raise ValueError(‘md5 sum does not match!’) Existing output now, but only desired when called with foo.py …

Total answers: 4