[pycsw-devel] Error requesting iso

Sophie Herrmann sophie.herrmann at eodc.eu
Tue Oct 29 09:06:17 PDT 2019


Hello pycsw-team!

I just set up pycsw locally, inserted some xmls and tried to retrieve them again (using getRecordById) and I got an error when requesting http://isotoc211.org/2005/gmd as outputSchema.

In more detail I get the following error:
...
  File "some/path/to/pycsw/pycsw/plugins/profiles/apiso/apiso.py", line 389, in write_record
    if caps is None and xml_blob is not None and xml_blob.startswith(b'<gmd:MD_Metadata'):
TypeError: startswith first arg must be str or a tuple of str, not bytes

It seems that my xml_blob is of type string not bytes. I tried to understand where the object is coming from, and for what I see it's the unchanged
content of the xml  database column. I inserted xmls in iso format (see attachment) so I assume they are stored as they are in this database column.

Coming back to the types, the xml column is of type text, so it makes sense that xml_blob is of type string. Following this idea I tried to use
'<gmd:MD_Metadata' instead of b'<gmd:MD_Metadata'. This works for me, so I get the expected xml.

Do you understand why this is happening for me?

Maybe also important: I'm using postgresql with postgis extension as a database.

Thanks a lot for any help!
Best,
Sophie

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pycsw-devel/attachments/20191029/59a50115/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: S2A_MSIL1C_20180101T231121_N0206_R058_T57FWV_20180101T235520.xml
Type: text/xml
Size: 10360 bytes
Desc: S2A_MSIL1C_20180101T231121_N0206_R058_T57FWV_20180101T235520.xml
URL: <http://lists.osgeo.org/pipermail/pycsw-devel/attachments/20191029/59a50115/attachment.xml>


More information about the pycsw-devel mailing list