Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

list indices must be integers, not str #31

Open
ernohorvath opened this issue Aug 31, 2016 · 1 comment
Open

list indices must be integers, not str #31

ernohorvath opened this issue Aug 31, 2016 · 1 comment

Comments

@ernohorvath
Copy link

Tried gen_outline.py and failed.
Got the following error, as I'm not a developer I have no clue what have I missed..
Traceback (most recent call last):
File "gen_outline.py", line 85, in
main()
File "gen_outline.py", line 75, in main
outline = make_outline(args.json_file, args.each_line, args.collection)
File "gen_outline.py", line 50, in make_outline
key_map = gather_key_map(iterator)
File "gen_outline.py", line 31, in gather_key_map
for d in iterator:
File "gen_outline.py", line 26, in coll_iter
for obj in data[coll_key]:
TypeError: list indices must be integers, not str

It's a standard mongodb json extract.

@evidens
Copy link
Owner

evidens commented Sep 1, 2016

For MongoDB you need to specify --each-line (JSON usually only has one object per file but Mongo breaks that rule and puts a bunch in the same file).

python gen_outline.py --each-line <yourfile>
python json2csv.py --each-line <yourfile> <outline file from previous step>

Hope that helps. I'll update the README with a call-out for Mongo so it's clearer to the next person.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants