GIS Programming: Debugging and Error Handling
"At the source of every error which is blamed on the computer you will find at least two human errors, including the error of blaming it on the computer." ~Anonymous The art of debugging is arguably one of the most important skills for any programmer. Procedures for debugging include: Reviewing error messages Inserting print messages at select locations within the script Commenting out lines or sections of code Using a debugger Our task for this week's lab was to debug two pre-written scripts using some of the above procedures and add a try-except statement to a third script to catch the error. Script 1 Script one contained two errors and/or exceptions that needed to be fixed in order for the script to run. Once fixed, the script printed out the names of all fields within the parks.shp attribute table. Flowchart for Script 1. Script 1 output. Script 2 Script 2 contained several errors/exceptions that needed to be corrected in order for the script to run. This scri