geopython / OWSLib

OWSLib is a Python package for client programming with Open Geospatial Consortium (OGC) web service (hence OWS) interface standards, and their related content models.
https://owslib.readthedocs.io
BSD 3-Clause "New" or "Revised" License
389 stars 275 forks source link

exception using csw.harvest() in owslib 0.9.0 #250

Closed cehbrecht closed 9 years ago

cehbrecht commented 9 years ago

Hi *,

did the interface of csw.harvest() change? I'm harvesting a wps service (which worked in 0.8.13):

csw.harvest(source="http://localhost:8091/wps", resourcetype="http://www.opengis.net/wps/1.0.0")

and i get the exception::

ExceptionReport                           Traceback (most recent call last)
<ipython-input-3-c640f6713291> in <module>()
----> 1 csw.harvest(source="http://localhost:8091/wps", resourcetype="http://www.opengis.net/wps/1.0.0")

/home/pingu/anaconda/lib/python2.7/site-packages/owslib/csw.pyc in harvest(self, source, resourcetype, resourceformat, harvestinterval, responsehandler)
    471         self.request = node0
    472 
--> 473         self._invoke()
    474         self.results = {}
    475 

/home/pingu/anaconda/lib/python2.7/site-packages/owslib/csw.pyc in _invoke(self)
    658         val = self._exml.find(util.nspath_eval('ows:Exception', namespaces))
    659         if val is not None:
--> 660             raise ows.ExceptionReport(self._exml, self.owscommon.namespace)
    661         else:
    662             self.exceptionreport = None

ExceptionReport: "Harvest failed: record parsing failed: Type 'Element' cannot be serialized."

Cheers, Carsten

tomkralidis commented 9 years ago

@cehbrecht I think this is an issue with the underlying CSW server. Do you have a csw endpoint to test?

cehbrecht commented 9 years ago

i'm using pycsw 1.10.1, of course ;) But my service is not open accessible.

I experienced more troubles with owslib 0.9 (accessing pywps). Everything works with previous versions (0.8.13 or below).

I'm using owslib from anaconda which i build myself: https://github.com/bird-house/conda-recipes/tree/master/ocgis

You can get my 0.9 version from binstar on the dev channel:

$ conda install -c https://conda.binstar.org/birdhouse/channel/dev owslib

Is there maybe a dependency missing or do i need to use different versions (lxml, ...)?

tomkralidis commented 9 years ago

@cehbrecht good CSW choice! :smile:

I tested this against OWSLib master and a local CSW (pycsw) instance to harvest http://cida.usgs.gov/gdp/utility/WebProcessingService and everything worked as expected. OWSLib has an etree wrapper which looks for lxml first, etc.

Looking at the exception caught by OWSLib, it looks like a pycsw harvesting error. Perhaps you can run a bare CSW Harvest request against the pycsw instance first to rule out an issue there? If that works, then there is something wrong downstream.

cehbrecht commented 9 years ago

its all fine with OWSLib :)

but i'm running into a version conflict with requests:

 File "/home/pingu/.conda/envs/birdhouse/lib/python2.7/site-packages/paste/deploy/loadwsgi.py", line 640, in find_egg_entry_point
pkg_resources.require(self.spec)
 File "/home/pingu/.conda/envs/birdhouse/lib/python2.7/site-packages/setuptools-18.0.1-py2.7.egg/pkg_resources/__init__.py", line 952, in require
 File "/home/pingu/.conda/envs/birdhouse/lib/python2.7/site-packages/setuptools-18.0.1-py2.7.egg/pkg_resources/__init__.py", line 844, in resolve
 pkg_resources.ContextualVersionConflict: (requests 2.6.0 (/home/pingu/.conda/envs/birdhouse/lib/python2.7/site-packages), Requirement.parse('requests>=2.7'), set(['owslib']))

i've no clue where the requests=2.6 requirement comes from. I'm using owslib in anaconda and only requests=2.7 is installed.

I suppose if i would remove the explicit requests>=2.7 requirement in OWSLib this check would pass and things will work ...

cehbrecht commented 9 years ago

fixed with requirement requests>=1.0