This past week focused on Debugging and Errors. We had to ensure that three different scripts would run properly, without any errors. I think it's fairly easy to be able to find and locate different errors and be able to correct them. In the first image located below, we were given instructions to correct the two errors/exceptions located within the script. After doing so, the script should successfully print the names of all of the fields in the parks.shp attribute table. In the second script provided, there were eight errors/exceptions which needed to be fixed. As seen in the second image below, the script successfully prints out the names of all the layers within the data frame. Finally, the third script provided contained errors that were preventing it from running. Rather than fixing those errors, we were asked to use a try-except statement. I struggled with this part of the assignment, a little bit. I was unsure where to place the try-except statements. But fortunately, I was able to figure it out and run the script without getting any error messages. In the third image below, Part A prints an error statement stating the problem. Whereas Part B encountered no errors and successfully printed out the Name, Spatial Reference, and Scale of the data frame.
No comments:
Post a Comment