basic_json_dump.py yields: TypeError: 'list' object is not an iterator
Mark-L6n opened this issue · comments
Mark-L6n commented
When using the example code from https://github.com/kensho-technologies/qwikidata/tree/develop/examples/basic_json_dump.py (which appears to be the same as the docs), I get the following error messages:
File "test-qwikidata.py", line 56, in <module>
dump_entities_to_json(politicians, out_fname)
File "path/to/py35/lib/python3.5/site-packages/qwikidata/utils.py", line 31, in dump_entities_to_json
ent = next(entities, None)
TypeError: 'list' object is not an iterator
Used dump latest-all.json.bz2
downloaded 11/4/22 from here
Occurs in both python 3.5 and 3.10.
Is there a way around this?
Gabriel Altay commented
Gabriel Altay commented
to check if my hunch is correct you could try passing iter(politicians)
to the dump_entities_to_json
function
Mark-L6n commented
Your hunch is correct, that works, thanks!
Gabriel Altay commented
fixed in #36 and new version pushed to PyPI, thanks again for the report!
https://pypi.org/project/qwikidata/