Monday, June 6, 2016

Module 4 Debugging and Errors


Screen Shots of all three scripts interactive window:












Screenshot of Flow Chart:





















Errors corrected in Script 1:
Line 10, corrected incorrect syntax for file path (/ to \)
Line 12, corrected improper capitalization for variable fc to FC

Line 14, corrected improper spelling so that the line read for field in fields:

Process Summary notes for Script 3:
1.      Initially I ran the script to locate the error and type.
2.      I used a try statement at line 13 and an except statement and print command on lines 15 and 15 to generate the error that two arguments for needed in line 14
3.      I then ran the script to locate the next error and type.
4.      I used a try statement at line 17 and an except statement and print command on lines 24-26 to print “parks” and then return the error that “mapdoc” and “lyrlist” were not defined.
5.      I ran the script again to locate the next error
6.      I used a try statement at line 27 and an except statement and print command at lines 30-31 to return the “mapdoc” and “lyrlist” were not defined.
7.      I then removed all my try and except statements except the first try statement at line 13.
8.      I placed my except statement at line 23 except (TypeError, NameError): and a print command on lines 24 and 25 to return the error types and the layer name that was supposed to be returned if the script was corrected.
9.      When I ran the script again, the errors for part A printed and the script continued to run through Part B and generate the Name, Spatial reference and scale of the dataframe.

No comments:

Post a Comment