I'm using owslib.wps inside a QGIS plugin to retrieve a pywps query output. Here is a piece of code that I run from the QGIS console:

import owslib.wps
from owslib.wps import WebProcessingService, printInputOutput, monitorExecution

processid = 'tp_np1'
wps = WebProcessingService('http://myhost/wps', verbose=False)
inputs = [("input1", "table01"),
execution = wps.execute(processid, inputs)

out = execution.processOutputs[0].data[0]
table_name = out.rsplit('/', 1)[1]

vlayer = QgsVectorLayer(out, table_name, "ogr")
if not vlayer.isValid():
  print ("Layer failed to load!")


When I run a long query, I get this error:

Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 386, in _make_request
six.raise_from(e, None)
File "<string>", line 2, in raise_from
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 382, in _make_request
httplib_response = conn.getresponse()
File "C:\OSGEO4~1\apps\Python36\lib\http\client.py", line 1331, in getresponse
File "C:\OSGEO4~1\apps\Python36\lib\http\client.py", line 297, in begin
version, status, reason = self._read_status()
File "C:\OSGEO4~1\apps\Python36\lib\http\client.py", line 258, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "C:\OSGEO4~1\apps\Python36\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
socket.timeout: timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\adapters.py", line 423, in send
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 649, in urlopen
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\util\retry.py", line 347, in increment
raise six.reraise(type(error), error, _stacktrace)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\packages\six.py", line 686, in reraise
raise value
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 600, in urlopen
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 388, in _make_request
self._raise_timeout(err=e, url=url, timeout_value=read_timeout)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\packages\urllib3\connectionpool.py", line 308, in _raise_timeout
raise ReadTimeoutError(self, url, "Read timed out. (read timeout=%s)" % timeout_value)
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPConnectionPool(host='myhost', port=8080): Read timed out. (read timeout=30)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\OSGEO4~1\apps\Python36\lib\code.py", line 91, in runcode
exec(code, self.locals)
File "<input>", line 1, in <module>
File "<string>", line 9, in <module>
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 275, in execute
response = execution.submitRequest(request)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 732, in submitRequest
self.url, request, method='Post', username=self.username, password=self.password)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 475, in readFromUrl
return self._readFromUrl(url, data, method, username=username, password=password)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\wps.py", line 396, in _readFromUrl
username=username, password=password)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\owslib\util.py", line 183, in openURL
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\api.py", line 56, in request
return session.request(method=method, url=url, **kwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\sessions.py", line 488, in request
resp = self.send(prep, **send_kwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\sessions.py", line 609, in send
r = adapter.send(request, **kwargs)
File "C:\OSGEO4~1\apps\Python36\lib\site-packages\requests\adapters.py", line 499, in send
raise ReadTimeout(e, request=request)
HTTPConnectionPool(host='myhost', port=8080): Read timed out. (read timeout=30)

Is there a way to set a different timeout value ?

Note : I'm using QGIS Dev 2.99 with python 3.6, but also I'm getting the same error message with QGIS 2.18 and python 2.7

  • This may help. gis.stackexchange.com/questions/95163/…
    – nmtoken
    Jun 30, 2017 at 7:34
  • Yes it's a client side problem. My pywps is configured under apache and I get no timeout error when running the query from the navigator
    – Adam Adam
    Jun 30, 2017 at 7:46
  • How long is the server taking to process the request? Would asynchronous mode be more appropriate? Jul 3, 2017 at 15:19

1 Answer 1


May be this is not the best solution, but this is how I solved my problem.
I edited the socket.py file as follows:

            587 except timeout:
            588     #self._timeout_occurred = True
            589     #raise
            590     pass

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.