Improve python3 exception handling.
Fix example.py (needs to be rewritten).