Friday, May 31, 2024

Module 3 - Debugging and Error Handling

 Script 1

For Part 1 of the assignment, the script had two errors that needed fixing to ensure it could run smoothly. After identifying and correcting these errors, the script successfully printed out the names of all fields on the parks.shp attribute table. I made sure to examine the attribute table in ArcGIS Pro beforehand to understand the expected output. 


Script 2

Moving on to Part 2. This script contained several errors and exceptions that needed addressing for it to run properly. Before running the script, I ensured that the required shapefiles were added to the ArcGIS Project TravisCountyAustinTX.aprx. After identifying and fixing the errors, the script successfully printed out the names of all layers in the project


Script 3
 Part 3 of the assignment had a script that intentionally contained an error that prevented part of it from running. Instead of fixing the error, I modified the script by adding try-except statements to catch any exceptions and print relevant error messages. The script had two parts: Part A, which encountered the error and printed an error statement stating the problem, and Part B, which ran successfully and printed out the name, data source, and spatial reference of each layer. 




No comments: