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
381 stars 273 forks source link

XMLSyntaxError Opening and ending tag mismatch, but it works using qGIS or ArcMap. #336

Closed murdav closed 8 years ago

murdav commented 8 years ago

Hello,

I'm using OWSLib==0.11.2 while testing this:

from owslib.wms import WebMapService
wms = WebMapService('http://edo.jrc.ec.europa.eu/edov2/php/ows.php?SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities')

I got this error:

File "", line unknown XMLSyntaxError: Opening and ending tag mismatch: BR line 6 and FONT, line 7, column 8

What does it mean? Using gGIS or ArcMap I'm able to load the WMS correctly.

Thanks in advance,

Davide

domlowe commented 8 years ago

I can't reproduce this error - it works for me.

What version of python are you using? Do you get the capabilities document OK in your browser with that URL?

murdav commented 8 years ago

After many attempts I discovered it's problem related onlyto my VirtualBox, where I randomly I got also this error:

Network Error (tcp_error)
A communication error occurred: "" 
workon myenv1
Python 3.5.1+ (default, Mar 30 2016, 22:46:26) 
[GCC 5.3.1 20160330] on linux
Type "help", "copyright", "credits" or "license" for more information.

>>> from owslib.wms import WebMapService
>>> wms = WebMapService('http://edo.jrc.ec.europa.eu/mapserv/mapserv?map=/var/www/edo/mapfiles/droughts/edo.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/virtualenvs/myenv1/lib/python3.5/site-packages/owslib/wms.py", line 85, in __init__
    self._capabilities = reader.read(self.url, timeout=self.timeout)
  File "/srv/virtualenvs/myenv1/lib/python3.5/site-packages/owslib/wms.py", line 700, in read
    return etree.fromstring(u.read())
  File "/usr/lib/python3.5/xml/etree/ElementTree.py", line 1333, in XML
    parser.feed(text)
xml.etree.ElementTree.ParseError: mismatched tag: line 7, column 2

workon myenv2
Python 2.7.11+ (default, Apr 17 2016, 14:00:29) 
[GCC 5.3.1 20160413] on linux2
Type "help", "copyright", "credits" or "license" for more information.

>>> from owslib.wms import WebMapService
>>> wms = WebMapService('http://edo.jrc.ec.europa.eu/mapserv/mapserv?map=/var/www/edo/mapfiles/droughts/edo.map&SERVICE=WMS&VERSION=1.1.1&REQUEST=GetCapabilities')

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/srv/virtualenvs/myenv2/local/lib/python2.7/site-packages/owslib/wms.py", line 85, in __init__
    self._capabilities = reader.read(self.url, timeout=self.timeout)
  File "/srv/virtualenvs/myenv2/local/lib/python2.7/site-packages/owslib/wms.py", line 700, in read
    return etree.fromstring(u.read())
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1311, in XML
    parser.feed(text)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1653, in feed
    self._raiseerror(v)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1517, in _raiseerror
    raise err
xml.etree.ElementTree.ParseError: mismatched tag: line 7, column 2
domlowe commented 8 years ago

Ok, it looks like the VM can't access the web. Thanks for closing the issue.