Error requesting iso

Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Error requesting iso

Sophie Herrmann
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
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pycsw-devel

S2A_MSIL1C_20180101T231121_N0206_R058_T57FWV_20180101T235520.xml (13K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Error requesting iso

Tom Kralidis
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
wish.

..Tom


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

On Tue, Oct 29, 2019 at 12:06 PM Sophie Herrmann
<[hidden email]> 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
> [hidden email]
> https://lists.osgeo.org/mailman/listinfo/pycsw-devel
_______________________________________________
pycsw-devel mailing list
[hidden email]
https://lists.osgeo.org/mailman/listinfo/pycsw-devel