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

AttributeError: 'list' object has no attribute 'items' #7

Open
RasmusMalver opened this issue Dec 12, 2023 · 0 comments
Open

AttributeError: 'list' object has no attribute 'items' #7

RasmusMalver opened this issue Dec 12, 2023 · 0 comments

Comments

@RasmusMalver
Copy link

Regardless of input, I get this error. Python 3.11.6 on MacOS Sonoma 14.2 (23C64).

$ json2tree -j base.json -o output.html

Traceback (most recent call last):
  File "~/folder/bin/json2tree", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "~/folder/lib/python3.11/site-packages/json2tree/__main__.py", line 62, in main
    run(args)
  File "~/folder/lib/python3.11/site-packages/json2tree/__main__.py", line 31, in run
    html_string = readJSON(args.json, args.theme)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/folder/lib/python3.11/site-packages/json2tree/__main__.py", line 18, in readJSON
    html_string = html_1.create_html_report(json_data)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/folder/lib/python3.11/site-packages/json2tree/theme_1/html.py", line 104, in create_html_report
    report = report + '\n' + report_dict_to_html(report_dict)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/folder/lib/python3.11/site-packages/json2tree/theme_1/html.py", line 95, in report_dict_to_html
    html_string = html_string + dict_handler(dict_obj, 0)
                                ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "~/folder/lib/python3.11/site-packages/json2tree/theme_1/html.py", line 63, in dict_handler
    for k, v in dict_obj.items():
                ^^^^^^^^^^^^^^
AttributeError: 'list' object has no attribute 'items'

I tried with a base file, containing just:

[{"a":"b"}]
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

1 participant