07 June 2023

M3 Debugging and Error Handling

This week's module challenged us to find more errors and added a try-except statement to bypass an error in a script. This accounts for the error and still prints (displays) the data. I cannot say it has gotten easier "dealing" with Python programming but things certainly make more sense when I see and am able to correct errors. When presented with a script pause to look at it before running it, and pick out obvious errors that are present. Of course, the caveat is when the script runs, errors will present themselves where they were not visible before. 

The errors in the script could be misspelled words (ex. reference vs. reference or map vs. maps) or punctuation. Whatever they may be that is the point of each week's assignment and it never disappoints to frustrate and once scripts run correctly, feel the great thrill of victory. We had three scripts this week to find errors and run correctly, one of which introduced a try-except statement that accounts for the error but still runs. As Dr. Morgan and also in Agarwal's readings have reiterated several times, flow charts help create a path of enlightenment through the process of writing, editing, correcting, and completion of running the script with the correct response.

Script 1 results



Script 2 results


Script 3 results


Try-Except flow chart


No comments:

Post a Comment

UWF Student. Aspiring GIS Analyst.

Key takeaways from a GIS job search

  A job search can be daunting, time-consuming, and frustrating. There are words to add to that short list that are more-or-less synonyms of...