Posts

Showing posts from May, 2026

Module 3: Error Handling and Debugging

Image
 Module 3 focused on debugging Python scripts. The lab taught me how to identify syntax, runtime and file path-related errors while improving my understanding of troubleshooting techniques and exception handling. Three scripts were successfully debugged.  Script 1  For the first script, I first received a name error stating that ‘fc’ is not defined. To fix this, I changed it to ‘FC’. The second error I received was another Name error stating that field is not defined. To fix this error, I switched ‘fields’ to ‘field’. The script then ran successfully, as shown above. Script 2  The first error received on the second script was a syntax warning on line 15, saying there was an invalid escape sequence (/p). To fix this, I simply fixed the backslash to the proper form. The second error was a name error on line 14, stating that ‘Filepath’ was not described. To fix this, I just had to change ‘Filepath’ to ‘filepath’ because Python is case-sensitive. The third error encounte...

Module 2: Python Fundamentals

Image
  In this week's lab, I learned Python fundamentals through scripting in the notebook in ArcGIS. I worked with variables, loops, lists, and conditional statements. I also had to troubleshoot some errors in the process. The final script, as shown above, generated random integers, simulates a dice game, removed an "unlucky" number from a list using a loop and conditional statements, and printed the final results successfully. This module helped strengthen my understanding of python syntax and working with the notebook in ArcGIS. Also shown above is a flowchart representing the script creation process. The first error I encountered when running the random script was the variable dice was an integer being concatenated with strings, so I fixed it by converting dice to a string using str(dice). The second error was caused by using an undefined variable X, so I corrected x to lowercase x.  Testing the code during the creation of the while loop helped me because the randomly gene...

Module 1: Python Environments & Flowcharts

Image
  I found this lab to be very straightforward and easy to follow, especially after completing the practice exercise and getting more familiar with the programs. I learned how to run a Python script and create a flowchart. Running the python script in IDLE was straightforward once the file was copied into the S drive. I learned how python scripts can automate repetitive tasks like creating folders. I found ease using both IDLE and ArcGIS notebooks, as well as running the tools.  From reading the Zen of Python:  The Zen of Python emphasizes writing code that is simple and readable. I think it aims to encourage users to avoid unnecessary complexity and focus on clarity when solving problems. A lot of the statements show that there are multiple ways to approach coding, but typically the best solution is the one that is easiest to understand. It highlights good programming habits to apply to make code more organized and useful for others.