Friday, July 25, 2014

GIS 5103 Module 9: Debugging and Error Handling



This week's module formally introduced us to the tools and tasks involved in debugging scripts.  While I'm sure we have all been forced to debug our scripts throughout the course, this module taught us how best to handle the inevitable errors that will plague us in our careers.  The debugging tool in PythonWin and try-except statements in particular will be useful in the future.

This assignment differed from previous ones in that we were given three scripts and tasked with debugging them.  The first two scripts contained several errors we needed to locate and correct for them to run properly.  For the final script, we were to insert a try-except statement that would trap the error in part A, print the error message to the interactive window, and continue to run part B of the script.  Below are screenshots of the interactive window messages resulting from my corrected scripts.



Script 1 interactive window after debugging.

Script 2 interactive window after debugging.


Script 3 interactive window after adding try-except statement.

No comments:

Post a Comment