better_exceptions package does exactly this, to enable it:
$ python -m pip install better_exceptions $ export BETTER_EXCEPTIONS=1 # Run your program from terminal