Closed Jonnyd55 closed 11 years ago
Hey Jon,
Could you log into the AP FTP and attach the /inits/VA/VA_ru.txt file?
-Ken Schwencke
On Mon, Oct 21, 2013 at 10:59 AM, Jon Davenport notifications@github.comwrote:
When firing up the wrapper, I get an error from reporting_units()
My code:
from elections import AP client = AP(USERNAME, PASSWORD) virginia = client.get_state('VA') print virginia
The error: File "test.py", line 5, in virginia = client.get_state('VA') File "..\elections\ap.py", line 73, in get_state_result = State(self, args[0], _kwargs) File "..\elections\ap.py", line 729, in init_super(State, Self).init(client, name, results, delegates) File "..\elections\ap.py", line 303, in _init_self._init_reporting_units() File "..\elections\ap.py", line 504, in _init_reporting_units num_reg_voters = int(r['re_regist_voters']), KeyError: re_regist_voters'
— Reply to this email directly or view it on GitHubhttps://github.com/datadesk/python-elections/issues/87 .
Sure thing. Just checking that file out solves the problem, I think. There is no 'ru_reg_voters' header there.
Here's the top:
| ru_number |ru_parent |ru_name |ru_abbrv |ru_type|rut_name|ru_fip|ru_precincts|
| 1| |Virginia|VA|S |State |00000 |2534|
| 47001| 1|Accomack|Accomack |C |County |51001 | 18|
| 47002| 1|Albemarle |Albemarle |C |County |51003 | 29|
| 47003| 1|Alleghany |Alleghany |C |County |51005 | 13|
I commented that key out and the module works great.
Ideally of course there'd be a reason for not having the number of registered voters in the data, and we could work that quirk into the code...glad it works for you though. We don't use that number in the module to calculate anything, so you're safe tossing it for now.
-Ken Schwencke
On Mon, Oct 21, 2013 at 11:47 AM, Jon Davenport notifications@github.comwrote:
Sure thing. Just checking that file out solves the problem, I think. There is no 'ru_reg_voters' header there.
Here's the top:
| ru_number |ru_parent |ru_name |ru_abbrv |ru_type|rut_name|ru_fip|ru_precincts| | 1| |Virginia|VA|S |State |00000 |2534| | 47001| 1|Accomack|Accomack |C |County |51001 | 18| | 47002| 1|Albemarle |Albemarle |C |County |51003 | 29| | 47003| 1|Alleghany |Alleghany |C |County |51005 | 13|
I commented that key out and the module works great.
— Reply to this email directly or view it on GitHubhttps://github.com/datadesk/python-elections/issues/87#issuecomment-26744753 .
So what's the proper fix here in the main repo? Failing silently/gracefully if the column can't be found?
Since it's a field that doesn't get used anywhere in the library, that could be the fix.
On Tuesday, October 22, 2013, Ben Welsh wrote:
So what's the proper fix here in the main repo? Failing gracefully if the column can't be found?
— Reply to this email directly or view it on GitHubhttps://github.com/datadesk/python-elections/issues/87#issuecomment-26874342 .
-Ken Schwencke
Hey @Jonnyd55, if you have a second give the master branch here a try by pulling the code direct from the GitHub repository and let us know if it fixes things for you.
Just gave it a shot. Works like a charm. Thanks a lot guys.
When firing up the wrapper, I get an error from reporting_units()
My code:
The error: File "test.py", line 5, in virginia = client.get_state('VA')
File "..\elections\ap.py", line 73, in get_state_result = State(self, args[0], **kwargs)
File "..\elections\ap.py", line 729, in _init_super(State, Self).init(client, name, results, delegates)
File "..\elections\ap.py", line 303, in _init_self._init_reporting_units()
File "..\elections\ap.py", line 504, in _init_reporting_units
num_reg_voters = int(r['re_regist_voters']),
KeyError: re_regist_voters'