Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cannot parse ISO-19115 XML records: 'list' object has no attribute 'title' #1076

Open
johnolulu opened this issue Feb 3, 2025 · 2 comments

Comments

@johnolulu
Copy link

johnolulu commented Feb 3, 2025

I recently upgraded my pycsw from 1.10.1 to 2.6.1. After upgrading, however, I am no longer able to load my ISO-19115 XML files into the pycsw database. I am running the pycsw-admin.py command as before:

/usr/share/pycsw/bin/pycsw-admin.py -c load_records -p /var/www/html/metadata/iso/ -f /usr/share/pycsw/default.cfg

But this now files fail to ingest all 968 of my ISO-19115 XML files with the same error:

Could not parse "/var/www/html/metadata/iso/ww3_samoa.xml" as an XML record
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/pycsw-2.6.1-py3.6.egg/pycsw/core/admin.py", line 348, in load_records
    record = metadata.parse_record(context, exml, repo)
  File "/usr/local/lib/python3.6/site-packages/pycsw-2.6.1-py3.6.egg/pycsw/core/metadata.py", line 117, in parse_record
    return _parse_metadata(context, repos, record)
  File "/usr/local/lib/python3.6/site-packages/pycsw-2.6.1-py3.6.egg/pycsw/core/metadata.py", line 142, in _parse_metadata
    return [_parse_iso(context, repos, exml)]
  File "/usr/local/lib/python3.6/site-packages/pycsw-2.6.1-py3.6.egg/pycsw/core/metadata.py", line 1250, in _parse_iso
    _set(context, recobj, 'pycsw:Title', md.identification.title)
**AttributeError: 'list' object has no attribute 'title'**

Here is the URL to our Web-accessible folder (WAF) of ISO-19115 XML files:

https://www.pacioos.hawaii.edu/metadata/iso/

And here is the URL to the specific ww3_samoa.xml given in the example above (although all of our files fail with the same error):

https://www.pacioos.hawaii.edu/metadata/iso/ww3_samoa.xml

Are you able to tell what is causing this error? These same files have all worked successfully for many years using pycsw 1.10.1 Many thanks for your help!

@pvgenuchten
Copy link
Contributor

pvgenuchten commented Feb 13, 2025

hi @johnolulu , not sure about that version, but in recent versions md.identification is a list object, so it would require md.identification[0].title, maybe you can pin your owslib to a lower version

see geopython/OWSLib@d4e26ea

@johnolulu
Copy link
Author

Many thanks for the tip, @pvgenuchten! I can confirm that this was the issue.

So, apparently the latest pycsw release (pycsw-2.6.1) is not compatible with the latest OWSLib release (owslib-0.31.0). I needed to downgrade the Python owslib module to owslib-0.28.1 in order for pycsw-2.6.1 to work. As mentioned in the link you provided, the md.identificationinfo container element is no longer recognized in owslib-0.29+, and is instead replaced by md.identification itself, which must then be treated as a list.

It might help others bumping into this same problem to document this as a requirement for pycsw, until it can hopefully be updated to work with the newer OWSLib.

@johnolulu johnolulu reopened this Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants