Wednesday, June 13, 2018

Debugging and Error Handling

This week the objective was for us to run through a variety of scenarios where we would need to debug a syntax. This was relatively straight forward in some instances but there were a few problems like part 3 of our assignment for the week that gave me quite a challenge.





Part 1 displays the list of field names from the parks shape file.



Part 2 displays the names of the layers within the MXD.






Part 3, displayed below, gave me so much trouble. I was overthinking the logic of the script way too much and I couldn't seem to find the proper use of if-except for running Part B. I kept wanting to change the errors in the script and just move one. I finally, just by trial and error was able to make the script work. Part A went smoothly with the addition of the if-except. 


Process Summary for Part 3 Step 2

1.      In order to get “part A” to work I had to implement try-except commands within the script.
2.      By doing this, it allowed for the code to bypass the errors that were computing from the results and still give results, which included the error.
3.      It took everything out of me to refrain from fixing the original errors that kept popping up every time I ran the debugger. Invalid mxd, not defined.
4.      The indentation is what continuously got me, time after time.
5.      Always keep the template of the script un-modified so you can go back to it to check the original script. I had to go recopy if from the R drive numerous times.

No comments:

Post a Comment

Module 7: Working with Rasters

This assignment was much more simple to me than our last previous few. It was more straightforward and I only struggled at the end. We wer...