Problem parsing a met file with METS Reader & Writer

35 views
Skip to first unread message

Edisnel Carrazana

unread,
Jun 10, 2016, 6:11:06 PM6/10/16
to archivematica

  Hello for everyone:

  I am testing METS Reader & Writer from https://github.com/artefactual-labs/mets-reader-writer and it works very good with the examples provided.
  But now I want to parse a file I have got from a Dspace system at my university through an oai request, and I have the following error:

  AttributeError: 'NoneType' object has no attribute 'get'

  Since I don't have access to the production servers of my university to do a Dspace export, I need to get the information via http, in the met file I have all the necessary to download the documents.

I need to know if it's a problem with the met file I'm parsing and how to fix it. Any recommendation will be welcomed. Thank you.

----- Attached some images ----



execution.png
metFile.png
pycharm.png

Holly Becker

unread,
Jun 21, 2016, 1:42:03 PM6/21/16
to archivematica
Hi Edisnel,

It looks like it failed to find the metsHdr element (and then failed to get the CREATEDATE from it) [1].  Since metsHdr is an optional element in METS, this should probably be fixed.

There's a couple of possible reasons for this, based on your METS file.  The namespacing on metsHdr could be wrong.  metsrw is looking for 'mets:metsHdr', where 'mets' is the namespace 'http://www.loc.gov/METS/'.  There's no namespace prefix shown but a default namespace could be set.  The other likely problem is the '<record><header><identifier>...' at the beginning of the file.  metsrw currently expects the root element to be <mets>, which has a child <metsHdr>.  If metsHdr is not a child of the root element, it won't be found.

Does this pass METS validation?  http://pim.fcla.edu/validate for example.

Cheers,
-Holly

[1] https://github.com/artefactual-labs/mets-reader-writer/blob/master/metsrw/mets.py#L296

Edisnel Carrazana

unread,
Jun 22, 2016, 8:47:24 AM6/22/16
to archivematica

  Thank you very much Holly, now I have a better understanding. May be I need to pre-process the METS file to pass a suitable file to METS Reader & Writer. Thanks again
Reply all
Reply to author
Forward
0 new messages