GIS4102 Lab 3 - Debugging

This lab was all about debugging script. We got to practice debugging code in two exercises, and in the third we had a chance to get buggy code to run without fixing it by using a try/except statement. This is still challenging to me as a novice programmer, and some of the code samples we're being provided aren't readily intelligible to me. But this is very good practice for learning how code works without a walkthrough, and requires us to do research and revisit the assigned texts.

Specific difficulties I encountered were specific indentation syntax errors - Python is very particular about indentation, and tabbing vs. spacing. I had also tried to run my Python script inside an ArcGIS aprx that was referenced by the code, which led to most of the code executing but not allowing the program to save as scripted, because the program was in use.

The errors that were left for us were relatively straightforward, but took a fair amount of effort on my part.

Using the try-except statement took a lot of experimentation on my part, because the instructions stipulated that the program had to finish without other errors and print an included completion message. I had to try several times to have my except statment within the bounds where an error would be identified but wouldn't allow other errors or preclude the final print statement. The final image in this post is a flowchart showing the logic of how the try/except statement operated in the provided script.

Comments

Popular posts from this blog

GIS 4006 Computer Cartography Intro Post

GIS4035 Lab 2, Land Use/Land Cover

GIS 4035, Lab 4: Spatial Enhancement and Multispectral Analysis