Election script help

5094
4
04-25-2016 07:26 PM
LeeMadison
New Contributor II

Trying to modify the elections app where I can update results using one spreadsheet.

Its for a small local election with 20 districts and each district has  different number of candidates.

district 1 might have 5 candidates & district 3 may only have 3 candidates . I can do it with 20 spreadsheets but that will get messy. Any idea how to edit the script that if a candidate space is empty it will skip?

This is the error.

Traceback (most recent call last):

  File "<string>", line 1682, in execute

  File "<string>", line 897, in runElectionResults

TypeError: int() argument must be a string or a number, not 'NoneType'


The spread sheet shows what I'm trying to do

0 Kudos
4 Replies
DanPatterson_Retired
MVP Emeritus

the script doesn't accept blank cells, it is trying to convert a string to an integer so whatever the line of the script refers to doesn't allow for nulls/blanks and/or it doesn't check for them and skip them

0 Kudos
LeeMadison
New Contributor II

Yeah I guess I need to figure out in the script how to make it skip blanks

0 Kudos
DanPatterson_Retired
MVP Emeritus

don't know what language but generically

if whatever != "":

    do something

if the variable whatever is not equal to "" (normally nothing, null, depending on language, database)

do the something part and it will skip it otherwise

0 Kudos
LeeMadison
New Contributor II

Its literally just using the ESRI elections script  http://links.esri.com/localgovernment/download/ElectionsResults/

So I'll have to brush up on my python!

0 Kudos