Figure 1 First Script - List of Airports |
Debugging and handling errors were emphasized in this week's module. Having experienced quite a bit of debugging my own scripts in this course, especially with syntax and using the technique of commenting out sections of code, this exercise and assignment were extensions of that but also included try-except statements. The first script, with results shown here, contained two relatively easy syntax errors which allowed the script to run after correction. A list of airports was printed as a result (Figure 1).
Finding the eight errors in the second script took longer. The errors in the second script included misspellings, incorrect punctuation, and arguments along with incorrect mxd and path names. Once corrected, the script printed out a list of layers in the data frame as shown in Figure 2.
Figure 2 Second Script - Layers in Data Frame |
The step-through mode of the debugger was quite helpful for this assignment. All the techniques for error and exception handling will be very useful in future assignments during the course and employment.
No comments:
Post a Comment