Print statements
Adding print statements to your code to print out values or even just to let you know how far the script progresses during execution is an easy way to help you debug your scripts. However, the downside to this method is that it takes time to add all those print statements, and then most of the time you aren't going to want to leave them in production code, so you'll have to take them out. Then, when an issue comes up, you must put the print statements back in again--essentially, it's a kludgy process.
Continuing with our GetCount() mishap earlier, let's look at a basic script that gets a count of the records in a feature class, and if the record count is greater than zero (there are features in the feature class), export ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access