Skip to content

Error:unorderable types in compare_xml.py #1

@bobgott

Description

@bobgott

Trapped Error:unorderable types for certain xml files within compare_xml.py

Description

I tried using your function in my python program and have found it traps an error for one of my xml files using to compare.

The problem is in function sort_dict(d). line 19: d[k] = sorted(v). For this xml file v happens to be a list of sorted dictionary objects and I believe sorted will not work in that case.

Steps to Reproduce

  1. extract out xml file from raw-new.zip (raw-new.xml)
  2. you can use raw-new.xml as both files.
  3. Execute python script. See error: Error:unorderable types: dict() < dict()
  4. <Any output logs, debug logs, that would identify the cause of the issue should be included>

Traceback (most recent call last):
File "C:/Users/suppo/Documents/Technology/Programming/Python/Projects/WikiExporter/tests/compare_xml.py", line 43, in
print(compare_xml_files(sys.argv[1], sys.argv[2]))
File "C:/Users/suppo/Documents/Technology/Programming/Python/Projects/WikiExporter/tests/compare_xml.py", line 35, in compare_xml_files
xmldict1 = sort_dict(xmldict1)
File "C:/Users/suppo/Documents/Technology/Programming/Python/Projects/WikiExporter/tests/compare_xml.py", line 13, in sort_dict
d[k] = sort_dict(v)
File "C:/Users/suppo/Documents/Technology/Programming/Python/Projects/WikiExporter/tests/compare_xml.py", line 19, in sort_dict
d[k] = sorted(v)
TypeError: unorderable types: dict() < dict()

Process finished with exit code 1

Expected behavior:
No error expected

Reproduces how often:
Every time with attached file

Versions

Master branch as of 5/22/2018

Additional Information

The problem seems to be due to XML nodes having the same tags ('Item')

raw-new.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions