WKT_EXPR.match(wkt): cannot use a string pattern on a bytes-like object
rldhont opened this issue · 0 comments
rldhont commented
ERROR Worker Error: cannot use a string pattern on a bytes-like object
Traceback (most recent call last):
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/poolserver/worker.py", line 84, in worker_handler
result = (True, func( *args, **kwargs ))
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/processingexecutor.py", line 285, in _run_process
handler(wps_request, wps_response)
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/processingprocess.py", line 351, in _handler
parameters = dict( input_to_processing(ident, inp, alg, context) for ident,inp in request.inputs.items() )
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/processingprocess.py", line 351, in <genexpr>
parameters = dict( input_to_processing(ident, inp, alg, context) for ident,inp in request.inputs.items() )
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/processingio.py", line 298, in input_to_processing
geometryio.get_processing_value(param, inp, context) or \
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/io/geometryio.py", line 215, in get_processing_value
value = input_to_point( inp[0] )
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/io/geometryio.py", line 189, in input_to_point
g = input_to_geometry( inp )
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/io/geometryio.py", line 175, in input_to_geometry
return wkt_to_geometry(inp.data)
File "/opt/local/pyqgiswps/lib/python3.8/site-packages/pyqgiswps/executors/io/geometryio.py", line 117, in wkt_to_geometry
m = WKT_EXPR.match(wkt)
TypeError: cannot use a string pattern on a bytes-like object
The wkt
provided to wkt_to_geometry
is not a string available regex match method.
The wkt
comes from WPSInput.data
.
The request was:
<wps:Execute xmlns:wps="http://www.opengis.net/wps/1.0.0" version="1.0.0" service="WPS" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">pyqgiswps_test:testpoint</ows:Identifier>
<wps:DataInputs>
<wps:Input>
<ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">INPUT</ows:Identifier>
<ows:Title xmlns:ows="http://www.opengis.net/ows/1.1">Point</ows:Title>
<wps:Data>
<wps:ComplexData mimeType="application/wkt" encoding="utf-8" schema=""><![CDATA[CRS=4326;POINT(-4 48)]]></wps:ComplexData>
</wps:Data>
</wps:Input>
</wps:DataInputs>
<wps:ResponseForm>
<wps:ResponseDocument storeExecuteResponse="true" status="true">
<wps:Output>
<ows:Identifier xmlns:ows="http://www.opengis.net/ows/1.1">OUTPUT</ows:Identifier>
<ows:Title xmlns:ows="http://www.opengis.net/ows/1.1"/>
<ows:Abstract xmlns:ows="http://www.opengis.net/ows/1.1"/>
</wps:Output>
</wps:ResponseDocument>
</wps:ResponseForm>
</wps:Execute>
The algorithm is:
""" Test getting point
"""
from qgis.core import (QgsProcessingParameterPoint,
QgsProcessingOutputString,
QgsProcessingAlgorithm)
class TestPoint(QgsProcessingAlgorithm):
INPUT = 'INPUT'
OUTPUT = 'OUTPUT'
def __init__(self):
super().__init__()
def name(self):
return 'testpoint'
def displayName(self):
return 'Test Point'
def createInstance(self, config={}):
""" Virtual override
see https://qgis.org/api/classQgsProcessingAlgorithm.html
"""
return self.__class__()
def initAlgorithm(self, config=None):
""" Virtual override
see https://qgis.org/api/classQgsProcessingAlgorithm.html
"""
self.addParameter(QgsProcessingParameterPoint(self.INPUT, 'Point'))
self.addOutput(QgsProcessingOutputString(self.OUTPUT, "Output"))
def processAlgorithm(self, parameters, context, feedback):
""" Virtual override
see https://qgis.org/api/classQgsProcessingAlgorithm.html
"""
point = self.parameterAsPoint(parameters, self.INPUT, context)
crs = self.parameterAsPointCrs(parameters, self.INPUT, context)
return {self.OUTPUT: point.toString(8)+' ('+crs.authid()+')'}