Improve PyCode exception handling including emails for scheduler