Closed jcii closed 13 years ago
This seems to be an issue in their responses, I've added a workaround that should fix this (if you update it should work). Let me know if you have any other issues, their API can be less than friendly at times.
-james
On Fri, Jun 17, 2011 at 5:19 AM, jcii < reply@reply.github.com>wrote:
Hello,
Thanks for your work on this; it's awesome. I am teaching myself python with a project where I'm using your library to iterate through pvs's data.
I think I've found an issue, but I could be mis-using the library. Here is the relevant code:
for state in votesmart.state.getStateIDs(): print state.stateId if (state.stateId == 'NA' or state.stateId == 'AS'): continue for candidate in votesmart.officials.getStatewide(state.stateId): print repr(candidate)
So the getStatewide() works for NA (National) and AS (American Samoa). The next State is Florida. It gives me the following error:
Traceback (most recent call last): File "/home/jimmy/workspace/votesmart/src/Candidates.py", line 13, in
for candidate in votesmart.officials.getStatewide(state.stateId): File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 478, in getStatewide return _result_to_obj(Official, result['candidateList']['candidate']) File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 196, in _result_to_obj return [cls(o) for o in result] File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 24, in __init__ self.**dict** = d TypeError: **dict** must be set to a dictionary, not a 'unicode' Can you please take a look at this and tell me if it's my error, of if I'm using the library as intended? Thanks. -Jimmy ## Reply to this email directly or view it on GitHub: https://github.com/sunlightlabs/python-votesmart/issues/6
rock n roll. So far so good. I've made it through IL without problems. I'm planning on iterating through every piece of data that votesmart has with your library, so I'll let you know if I find anything else.
Thanks again for this. Awesome.
Hello,
Thanks for your work on this; it's awesome. I am teaching myself python with a project where I'm using your library to iterate through pvs's data.
I think I've found an issue, but I could be mis-using the library. Here is the relevant code:
So the getStatewide() works for NA (National) and AS (American Samoa). The next State is Florida. It gives me the following error:
Traceback (most recent call last): File "/home/jimmy/workspace/votesmart/src/Candidates.py", line 13, in
for candidate in votesmart.officials.getStatewide(state.stateId):
File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 478, in getStatewide
return _result_to_obj(Official, result['candidateList']['candidate'])
File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 196, in _result_to_obj
return [cls(o) for o in result]
File "/usr/local/lib/python2.6/dist-packages/votesmart.py", line 24, in init
self.dict = d
TypeError: dict must be set to a dictionary, not a 'unicode'
Can you please take a look at this and tell me if it's my error, of if I'm using the library as intended? Thanks.
-Jimmy