Page 19 -
P. 19

table of contents


                                     exceptions and message boxes
                 8 /                 Get the message?



                                     Sometimes things just go wrong. You just need to handle it.
                                     There will always be things beyond your control. Networks will fail. Files will
                                     disappear. Smart coders learn how to deal with those kinds of errors and make
                                     their programs recover gracefully. The best software keeps the user informed
                                     about the bad things that happen and what should be done to recover. By learning
                                     how to use exceptions and message boxes, you can take your software to the
                                     next level of reliability and quality.




                                                  What’s that smell?                                 294
                                                   Someone changed the file permissions              295
                                                  When it couldn’t write to the file, the program threw an exception   296
                                                   Catch the exception                               297
                                                  Watch for exceptions with try/except               298
                                                  There’s an issue with the exception handler        302
                                                  A message box demands attention                    303
                                                   Creating message boxes in Python                  304
                                                  Your Programming Toolbox                           311





























           xviii
   14   15   16   17   18   19   20   21   22   23   24