Module 3 GIS Programming: Debugging and Error Handling
Hello all, the third week of GIS Programming (4102/5103) was to teach us how to debug code and handle errors within the code. The first main way to find errors in code is to check the module first to check for syntax errors. If a syntax error occurs, none of the code will even run because Python can not understand what was written. After finding potential syntax errors, runtime errors could be identified either by running the code to see the error message or by running a debug tool. I personally find it easier to run the code and see the error message but I understand that at times a debug tool would be very useful. We also learned of another way of handling errors to allow the script to run without necessarily fixing the problem. A try-except statement can capture an exception (or error) and allow the script to keep running without that part of the script. You can also use it to print the error that occurred, which can be helpful in fixing the error. ...