[Pywps-dev] Raster Output error

Lorenzo Bottaccioli lorenzo.bottaccioli at gmail.com
Wed Jun 8 02:50:08 PDT 2016


Hi List,

I'm trying to run a process that recives a GeoTIFF as input and response a
GeoTIFF as output. But I'm having an error. The process is this:

from pywps import Process, ComplexInput, ComplexOutput,
get_format,LiteralOutput, Format


class Raster(Process):

    def __init__(self):
        inputs = [ComplexInput('raster','Raster input',[Format('GEOTIFF')])]

        outputs = [ComplexOutput('raster_out', 'Raster
output',[Format('GEOJSON')]),LiteralOutput('response', 'Output response',
data_type='string')]
        super(Raster, self).__init__(
            self._handler,
            identifier='rast_try',
            title='Raster try',
            inputs=inputs,
            outputs=outputs,
            store_supported=True,
            status_supported=True
        )

    def _handler(self, request, response):

        from osgeo import gdal
        app=request.inputs['raster'][0].file
        inds = gdal.Open(app)
        outdriver = gdal.GetDriverByName('GTiff')
        outds = outdriver.CreateCopy('output.tiff', inds)
        outds.FlushCache()
        response.outputs['raster_out'].output_format = Format('GEOTIFF')
        response.outputs['raster_out'].file = 'output.tiff'
        response.outputs['response'].file = 'done'
        return response

The error that I recive is this one:

Traceback (most recent call last):
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/Process.py",
line 156, in _run_process
    wps_response.update_status('PyWPS Process finished', 100)
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/WPSResponse.py",
line 41, in update_status
    self.doc = self._construct_doc()
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/WPSResponse.py",
line 171, in _construct_doc
    output_elements = [self.outputs[o].execute_xml() for o in self.outputs]
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/inout/outputs.py",
line 276, in execute_xml
    literal_data_doc = WPS.LiteralData(text_type(self.data))
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/inout/basic.py",
line 231, in get_data
    return IOHandler.get_data(self)
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/inout/basic.py",
line 173, in get_data
    file_handler = open(self.source, mode='r')
IOError: [Errno 2] No such file or directory:
'/tmp/pywps/pypws_process_lQqN_6/done'
ERROR:root:Service error: near "''": syntax error
Traceback (most recent call last):
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/Service.py",
line 358, in _parse_and_execute
    wps_response = process.execute(wps_request, uuid)
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/Process.py",
line 145, in execute
    wps_response = self._run_process(wps_request, wps_response)
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/Process.py",
line 178, in _run_process
    wps_response.update_status('Process error: %s.%s Line %i %s' % (fname,
method_name, exc_tb.tb_lineno, e), -1)
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/app/WPSResponse.py",
line 47, in update_status
    update_response(self.uuid, self)
  File
"/usr/local/lib/python2.7/dist-packages/pywps-4.0-py2.7.egg/pywps/dblog.py",
line 67, in update_response
    cur.execute(update)
OperationalError: near "''": syntax error


How can I fix this?

Best,

Lorenzo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pywps-dev/attachments/20160608/289ce5fd/attachment.html>


More information about the pywps-dev mailing list