vladikk / JSON2CSV

Utility to convert json files to csv
Other
38 stars 23 forks source link

error when running on python3.5 #1

Closed vvanamu closed 7 years ago

vvanamu commented 8 years ago

Hi there,

I am getting the following error message when I run the script on python3.5 Had no issues and worked flawlessly on python2.6 Please let me know how I can make this script compatible with python3

Traceback (most recent call last): File "json2csv.py", line 64, in json_to_csv("responses.json", "responses.csv") File "json2csv.py", line 12, in json_to_csv dicts = json_to_dicts(json) File "json2csv.py", line 26, in json_to_dicts return [dict(to_keyvalue_pairs(obj)) for obj in objects] File "json2csv.py", line 26, in return [dict(to_keyvalue_pairs(obj)) for obj in objects] File "json2csv.py", line 36, in to_keyvalue_pairs result = [to_keyvalue_pairs(source[key], ancestors + [key]) for key in source.keys()] File "json2csv.py", line 36, in result = [to_keyvalue_pairs(source[key], ancestors + [key]) for key in source.keys()] File "json2csv.py", line 39, in to_keyvalue_pairs result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in to_keyvalue_pairs result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in to_keyvalue_pairs result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in to_keyvalue_pairs result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in to_keyvalue_pairs result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] File "json2csv.py", line 39, in result = [to_keyvalue_pairs(item, ancestors + [str(index)]) for (index, item) in enumerate(source)] RecursionError: maximum recursion depth exceeded while calling a Python object

vladikk commented 7 years ago

Ported to python3