geosolutions-it / geonode-rndt

Geonode-RNDT is a Django App to let GeoNode be able to expose the metadata compliant to the RNDT standard
BSD 2-Clause "Simplified" License
1 stars 1 forks source link

Error parsing metadata #104

Closed etj closed 1 year ago

etj commented 1 year ago
[2023-07-20 11:45:51,310: ERROR/ForkPoolWorker-360] Task importer.create_geonode_resource[15fa2277-d8f5-4c3c-8c1a-c0afcd1ab323] raised unexpected: ResourceCreationException()
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/importer/celery_tasks.py", line 332, in create_geonode_resource
    resource = handler.create_geonode_resource(
  File "/usr/local/lib/python3.10/dist-packages/importer/handlers/common/vector.py", line 533, in create_geonode_resource
    self.handle_xml_file(saved_dataset, _exec)
  File "/usr/local/lib/python3.10/dist-packages/importer/handlers/common/vector.py", line 578, in handle_xml_file
    resource_manager.update(
  File "/usr/src/geonode/geonode/resource/manager.py", line 382, in update
    _uuid, vals, regions, keywords, custom = parse_metadata(_md_file_content)
  File "/usr/src/geonode/geonode/layers/metadata.py", line 240, in parse_metadata
    uuid, vals, regions, keywords, custom = parser(exml, uuid, vals, regions, keywords, custom)
  File "/usr/src/rndt/rndt/layers/metadata.py", line 26, in rndt_parser
    exml = exml.getchildren()[0]
AttributeError: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/celery/app/trace.py", line 451, in trace_task
    R = retval = fun(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/celery/app/trace.py", line 734, in __protected_call__
    return self.run(*args, **kwargs)
  File "/usr/local/lib/python3.10/dist-packages/importer/celery_tasks.py", line 365, in create_geonode_resource
    raise ResourceCreationException(detail=error_handler(e))
importer.api.exception.ResourceCreationException: 'xml.etree.ElementTree.Element' object has no attribute 'getchildren'. Request: None
etj commented 1 year ago

There has been a deprecation in the XML library: https://docs.python.org/3.8/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getchildren