Improve reporting of Python exceptions