datadesk / python-elections

A Python wrapper for the Associated Press' U.S. election data service.
python-elections.rtfd.org
176 stars 46 forks source link

Illinois reporting unit, precincts_total = 0 #75

Closed eads closed 12 years ago

eads commented 12 years ago

I have some code like this, which is causing an error because the Illinois and Cook County reporting unit precincts_total are 0:

        il = client.get_state('IL')
        for race in il.races:
            ilru = race.get_reporting_unit('Illinois1')
            if options['generate_random_data']:
                precincts_reporting = randint(1,ilru.precincts_total)

I went in with the my handy interactive debugger and found all other Illinois reporting units have non-zero precincts_total values.

palewire commented 12 years ago

Check out the race names for the ones where you're getting 0 precincts. My bet: They are races that are in other parts of the state besides Cook County (like Recorder of Deeds in Lake County), where 0 is what you'd expect.

palewire commented 12 years ago

We have an unfixed ticket where we proposed nuking these guys, but it's never been patched. If you're going to write the code anyway, consider including it here. https://github.com/datadesk/python-elections/issues/22

eads commented 12 years ago

I'll close this and see if I can contribute to fixing that ticket.