I discovered that opening this WFS https://www.geoproxy.geoportal-th.de/geoproxy/services/STRNETZ_wfs with owslib leads to a crash when using version 1.0.0 or 2.0.0. With version 1.1.0 it works. Examples:
version 1.0.0
from owslib.wfs import WebFeatureService
wfs = WebFeatureService(url="https://www.geoproxy.geoportal-th.de/geoproxy/services/STRNETZ_wfs", version="1.0.0")
Causes this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dev/.local/lib/python3.11/site-packages/owslib/wfs.py", line 48, in WebFeatureService
return wfs100.WebFeatureService_1_0_0(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dev/.local/lib/python3.11/site-packages/owslib/feature/wfs100.py", line 112, in __init__
self._buildMetadata(parse_remote_metadata)
File "/home/dev/.local/lib/python3.11/site-packages/owslib/feature/wfs100.py", line 121, in _buildMetadata
self.identification = ServiceIdentification(serviceelem, self.version)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dev/.local/lib/python3.11/site-packages/owslib/feature/wfs100.py", line 310, in __init__
self.type = testXMLValue(self._root.find(nspath("Name")))
^^^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'find'
version 2.0.0
from owslib.wfs import WebFeatureService
wfs = WebFeatureService(url="https://www.geoproxy.geoportal-th.de/geoproxy/services/STRNETZ_wfs", version="2.0.0")
Causes this error:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/dev/.local/lib/python3.11/site-packages/owslib/wfs.py", line 56, in WebFeatureService
return wfs200.WebFeatureService_2_0_0(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/dev/.local/lib/python3.11/site-packages/owslib/feature/wfs200.py", line 87, in __init__
self._buildMetadata(parse_remote_metadata)
File "/home/dev/.local/lib/python3.11/site-packages/owslib/feature/wfs200.py", line 122, in _buildMetadata
for elem in self._capabilities.find(nspath("OperationsMetadata"))[:]:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
TypeError: 'NoneType' object is not subscriptable
version 1.1.0 works
Apparently the WFS Capabilites were kind of malformed, but I was surprised that a internal stack trace of owslib was returned. I would have expected that some "official" exception like MalformedXmlExcpetion or so would have been returned. At least, that would be a bit more user friendly and informative.
maybe related: #999
I discovered that opening this WFS
https://www.geoproxy.geoportal-th.de/geoproxy/services/STRNETZ_wfswithowslibleads to a crash when using version1.0.0or2.0.0. With version1.1.0it works. Examples:version 1.0.0
Causes this error:
version 2.0.0
Causes this error:
version 1.1.0 works
Apparently the WFS Capabilites were kind of malformed, but I was surprised that a internal stack trace of
owslibwas returned. I would have expected that some "official" exception likeMalformedXmlExcpetionor so would have been returned. At least, that would be a bit more user friendly and informative.maybe related: #999