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
Script 1 output. |
Script 2
Script 2 contained several errors/exceptions that needed to be corrected in order for the script to run. This script printed out the names of all the layers in the TravisCountyAustinTX.aprx project.
Flowchart for Script 2. |
Script 2 output. |
Script 3
Script 3 contained an error that prevented the script from running, but instead of fixing this error, our task was to insert a try-except statement so that the code would successfully run.
Flowchart for Script 3. |
Script 3 output. |
Comments
Post a Comment