List index out of range.
I'm getting this error when I input mets into a locally hosted demetsiiify:
File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/lib/python3.5/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/code/demetsiiify/blueprints/api.py", line 127, in api_import
job_meta = mets.get_basic_info(mets_url)
File "/code/demetsiiify/mets.py", line 382, in get_basic_info
doc.read_metadata()
File "/code/demetsiiify/mets.py", line 162, in read_metadata
self.metadata['title'] = self._read_titles()
File "/code/demetsiiify/mets.py", line 148, in _read_titles
".//mods:relatedItem[@type='host']/mods:titleInfo")[0]]
IndexError: list index out of range
Can you link the METS you're using?
Does this work if the images the METS references are not actually hosted, or will it only work if it can find the images there? Thanks
This is a sample METS file. It came with the path as ..\IMAGES\Output\ and I have tried it as that and as ../IMAGES/Output/ https://github.com/jcmundy/samplepage/blob/master/METS.xml
Oh, I'm afraid there are a couple of things:
- As listed under the caveats in the README, currently only METS/MODS that conforms to the German Research Foundation specifications is supported. I'll take a look at your METS and see if I can get it working, though.
- The images referenced in the METS currently must be hosted somewhere publicly. This is because the aforementioned specification doesn't mandate the inclusion of image dimensions in the metadata, so the app has to grab the actual images to determine the available sizes. However, it seems that in your case you have a
mets:techMDthat contains the neccessary information. I'll see if I can add support for that!
More broadly speaking, what's your use case for the app? Are you planning on serving IIIF from your current METS data or is it just for viewing convenience?
Thank you for your help. We are reworking an app that hosts files from using METS/ALTO to IIIF, so we are looking for a way to convert our old METS to IIIF for public hosting of files.
I have the plan to create a standalone library (along with a command-line interface) from the demetsiiify app that would allow you do that while providing your own IIIF Image hosting. Would that be useful?
The basic idea is to do something like:
$ demetsiiify-cli my_mets.xml \
--image-api-base=https://example.com/iiif/image \
-o manifest.json
Yes, that would be useful for us. That sounds great.
I have gotten one of our METS files to include the urls of the hosted images now, but it looks like the problem may be that we have used mix rather than mods? Is there a way to make that work? Thank you again for your help.