Hi Dom, I can't reproduce the error, it works well for me. I'm using python2.6 and ElementTree from the standard library. ¿Maybe a character encoding issue?
Note that xml encoding is utf-8: >>> from urllib2 import urlopen >>> from owslib.etree import etree >>> url = 'http://www.idee.es/wcs/IDEE-WCS-UTM30N/wcsServlet?service=WCS&request=GetCapabilities' >>> u=urlopen(url) >>> s = u.read() >>> s[20:36] 'encoding="UTF-8"' and that's also my filesystem encoding: >>> import sys >>> sys.getfilesystemencoding() 'UTF-8' At the moment I can think of three possible causes: a) The server response is indeed ill-formed, then we don't have to care (just don't test this). b) This is a bug in urllib2 (u.read() returns an invalid string from a good server) or ElementTree (fails to parse a valid string). c) We are supposed to do something with the xml string before passing it to fromstring. I'll try to investigate. Hints welcome. Dom, does this has to do with the optional version stuff? does it work if you add the version parameter to the url? Goyo El mié, 24-06-2009 a las 13:04 +0100, Dominic Lowe escribió: > Hi Goyo, > > I'm having trouble getting the wcs_idee test to pass. > I can demonstrate the problem with urllib2: > > >>> from urllib2 import urlopen > >>> from owslib.etree import etree > >>> > u=urlopen('http://www.idee.es/wcs/IDEE-WCS-UTM30N/wcsServlet?service=WCS&request=GetCapabilities') > >>> e=etree.fromstring(u.read()) > > <snip long traceback> > <class 'elementtree.ElementTree.ParseError'>: not well-formed (invalid > token): > line 17, column 25 > > Basically it's complaining about some characters in the XML here: > http://www.idee.es/wcs/IDEE-WCS-UTM30N/wcsServlet?service=WCS&request=GetCapabilities > > Do you have the same problem?? > > Cheers, > Dom > > > > On Monday 22 June 2009 00:29:49 Goyo wrote: > > Hi all, > > > > I didn't feel comfortable with version being mandatory in > > WebCoverageService calls since it's provided in GetCapabilities > > response. Or maybe I'm missing something? > > > > Find attached patches for wcsBase.py and wcs.py which make this > > parameter optional in WCSCapabilitiesReader.__init__ and > > WebCoverageService. The first one is necessary for the second one to > > work. I also modified the doctest test_idee.txt in order to test > > WebCoverageService (and WCSCapabilitiesReader.__init__). > > > > Cheers > > > > Goyo > > _______________________________________________ Community mailing list [email protected] http://lists.gispython.org/mailman/listinfo/community
