English

Error: ZeroDivisionError: integer division or modulo by zero (when using the Create Cell Site Features tool)

Error Message

ArcGIS for Local Government's Target Hazard Analysis tool 'Create Cell Site Features' returns the following error if there are 10 or fewer cell sites:

"ZeroDivisionError: integer division or modulo by zero"

Cause

If there are 10 or fewer cell sites in the spreadsheet, the progress bar cannot be incremented correctly.

Solution or Workaround

Modify the logic that builds the progress bar by adding the following two lines of code to the Python script:

Code:
if increment == 0:
increment = 1

In the context of the surrounding lines of code this will look like the following:

Code:
# For each tower, create antennas and sectors within the radius.
cnt = arcpy.management.GetCount(cell_towers)
increment = int(int(cnt[0]) / 10.0)
if increment == 0:
increment = 1
arcpy.SetProgressor("Step", "Creating Cell site features...", 0, int(cnt[0]), increment)