tests: Fix print_exception.py to work on Travis CI.