Module 2 - Debug and Error Handling
Script 1 - The goal of Part 1 of this week's module was to identify and correct errors in a given code. The purpose of this code was to print out the names of all fields on the attribute table for a given shapefile. After correcting the case-sensitive code, changing the file path from Module 3 to 2, and making sure all variables were spelled correctly I was able to successfully run the code.
Script 2 - Part 2 of this week's module was another exercise in identifying and correcting errors. The purpose of this code was to print a list of available shapefiles located on a map. Again, case-sensitivity and spelling caused errors as well as the correct use of all slashes. Once these corrections were made, the code ran successfully.
Script 3 - Part 3 of this module proved to be much more difficult for me than the other two scripts. The goal of this exercise was to for a code to run despite the errors using try-except statements. I had to use trial and error several times before I found an location within the code that would allow the code to operate successfully. In all honesty, if not for the class discussion board I'm not sure I would have completed this part of the module.
Comments
Post a Comment