Summary

In this chapter we took a close at look at how Python's exceptions work. We defined what an exception is and learned that dealing with exceptions and errors is a fact of programming life. We examined in detail the interesting traceback type and the exc_info tuple. We learned a set of best practices for handling errors, and how those best practices apply to Maya.

We spent the rest of the chapter putting together an exception hook function that will send an e-mail if any unhandled exception occurs in code we care about. We closed the chapter by covering several ways we can potentially improve our exception hook.

In the next chapter, we'll look at two relatively unique features of Python: context managers and decorators. They will help us fill ...

Get Practical Maya Programming with Python now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.