You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[2020-07-15 15:57:58,502: ERROR/ForkPoolWorker-4] Task AIPscan.Aggregator.tasks.get_mets[a24ce0ce-6e25-40d5-b117-ce5435944741] raised unexpected: AttributeError("'NoneType' object has no attribute 'tag'")
Traceback (most recent call last):
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/celery/app/trace.py", line 412, in trace_task
R = retval = fun(*args, **kwargs)
File "/Users/peter/Development/AIPscan/flask_celery.py", line 18, in __call__
return TaskBase.__call__(self, *args, **kwargs)
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/celery/app/trace.py", line 704, in __protected_call__
return self.run(*args, **kwargs)
File "/Users/peter/Development/AIPscan/AIPscan/Aggregator/tasks.py", line 271, in get_mets
mets = metsrw.METSDocument.fromfile(downloadFile)
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/mets.py", line 593, in fromfile
return cls.fromtree(etree.parse(path, parser=parser))
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/mets.py", line 617, in fromtree
mets._parse_tree(tree)
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/mets.py", line 543, in _parse_tree
tree, structMap, normative_parent_elem=normative_struct_map
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/mets.py", line 367, in _parse_tree_structmap
tree, elem, normative_parent_elem=normative_elem
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/mets.py", line 371, in _parse_tree_structmap
self._add_amdsecs_to_fs_entry(elem.get("ADMID"), fs_entry, tree)
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/mets.py", line 515, in _add_amdsecs_to_fs_entry
amdsec = metadata.AMDSec.parse(amdsec_elem)
File "/Users/peter/Development/AIPscan/venv/lib/python3.7/site-packages/metsrw/metadata.py", line 94, in parse
if root.tag != utils.lxmlns("mets") + "amdSec":
AttributeError: 'NoneType' object has no attribute 'tag'
The work around for now is to patch METSRW/metadata.py with the following code:
@classmethod
def parse(cls, root):
"""
Create a new AMDSec by parsing root.
:param root: Element or ElementTree to be parsed into an object.
"""
if root:
if root.tag != utils.lxmlns("mets") + "amdSec":
raise exceptions.ParseError(
"AMDSec can only parse amdSec elements with METS namespace."
)
section_id = root.get("ID")
subsections = []
for child in root:
subsection = SubSection.parse(child)
subsections.append(subsection)
return cls(section_id, subsections)
else:
return
The text was updated successfully, but these errors were encountered:
Given the related issue and this ticket here: #47 I feel we're doing enough to handle this in AIPscan now, and we can close this in favor of reporting the AIP errors summary. We will need to track metsrw and AIP changes upstream but this one might just resolve itself once Archivematica outputs the METS correctly.
METSRW tries to call a property for a non-existent object (inside a function that creates a new AMDSec by parsing the root element).
See https://github.com/artefactual-labs/mets-reader-writer/blob/master/metsrw/metadata.py#L94-L103
The error that is raised:
The work around for now is to patch METSRW/metadata.py with the following code:
The text was updated successfully, but these errors were encountered: