This week we took a step backwards in order to save some time in the future. We did this by learning how to fix errors we may encounter in our future Python script writing. Sometimes a simple punctation, spelling, or file path can halt you for hours, so finding these and fixing them is a invaluable lesson. The follow 3 script screenshots are from the lab lessons. 1 and 2 are fixed and run correctly. 3 contains error messages using a try-except statement concept. The last image is a flowchart on how I trapped error messages when they occurred in the 3rd script.
Script 1 shows names of fields in a park.shp attribute table. I fixed 2 errors (filepath and a punctuation)
Script 2 prints the names of all layers in the Project. Several errors (filepath, backslashes facing wrong directions, punctuation, spelling, and capitalization)
Script 3 has errors where some items are not defined in Part A and it was the assignment to showcase them, and Part B runs successfully printing ther name, data source and spatial reference of each layer.
Flowchart shows how I trapped the errors in aprx, project and lyrlist because they were not defined using a try-except statement.
Comments: These labs are a struggle in many ways, but thankfully the class is willing to help each other when we get stuck. Just a simple rewording of a step or concept can make it all make sense and move me forward.