GIS Programming- Handling errors and debugging
This week we learned how to handle errors and debugging script in Python. The goal of this module was to learn how to deal with syntax errors and exceptions, manually debug, and use debugging tools. In the assignment, we were given 3 template scripts with errors. In the first two, we fixed the errors to allow the code to run correctly. Below are the final outputs and flowcharts for these scripts. Script 1: The goal was to name the fields in a shapefile. Script 2: The goal was to print the spatial reference of the project and then list the layers in the project. In the final script (script 3), we were to ignore the errors and use a try-except statement to allow the script to run and produce an error message. As seen in section A's output, there is an error with the 'aprx_path' missing an argument. The try-except statement identifies this error and prints a message for the user. Part B is meant to provide the name, data source, a...