[pycsw-devel] Error requesting iso

Tom Kralidis tomkralidis at gmail.com
Thu Nov 7 16:30:32 PST 2019

Hi Sophie: thanks for the info.  There's an issue at [1] which has a patch
that seems to work.  What version of Python are you using and what is
your database backend?  Feel free to chime in on the ticket as well if you


[1] https://github.com/geopython/pycsw/issues/576#issuecomment-494138478

On Tue, Oct 29, 2019 at 12:06 PM Sophie Herrmann
<sophie.herrmann at eodc.eu> wrote:
> 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
> _______________________________________________
> pycsw-devel mailing list
> pycsw-devel at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/pycsw-devel

More information about the pycsw-devel mailing list