[Pywps-devel] Error on my first process
Ludwig Max Brinckmann
ludwigbrinckmann at gmail.com
Mon Nov 6 16:04:00 CET 2006
The 'premature end of script headers' is caused whenever you send something
back via the webserver that is not correctly mime encoded, eg. you python
syntax error.
To run this without the interference of the web server run the cgi like
python path-to-your-cgi-command 'inputparameters=like-this&or=like-this'
This will just execute your cgi and python will get the parameters out of
the string. This might help to see the python error more clearly
Ludwig
On 11/6/06, Jachym Cepicky <jachym.cepicky at centrum.cz> wrote:
>
> hallo,
>
> On Mon, Nov 06, 2006 at 01:38:50PM +0100, Luca Casagrande wrote:
> > Hi to all!
> >
> > I am trying to build a process that should do those tasks:
> >
> > 1) Read a txt file with the coordinates of a point
> > 2) Inport in GRASS as a point vector layer
> > 3) Crate a buffer around this point with a radius selected by user
> >
> > This is the script:
> >
>
> 1 #!/usr/bin/python
> 2
> 3 # Author: Luca Casagrande ( luca.casagrande at gmail.com )
> 4
> 5 import os,time,string,sys
> 6
> 7
> 8 class Process:
> 9 def __init__(self):
> 10 self.Identifier = "buffer"
> 11 self.processVersion = "0.1"
> 12 self.storeSupport = "true"
> 13 self.Title="Create a buffer around a point "
> 14 self.Abstract="Create a buffer around point"
> 15 self.grassLocation=
> "/home/geko/progetti/grass/dati/spearfish60/"
> 16 self.Inputs = [
> 17 # 0
> 18 {
> 19 'Identifier': 'point',
> 20 'Title': 'Input points',
> 21 'ComplexValueReference': {
> 22 'Formats':["text"],
> 23 },
> 24 },
> 25
> 26 # 1
> 27 {
> 28 'Identifier': 'radius',
> 29 'Title': 'Buffer radius',
> 30 'LiteralValue': {
> 31 'AnyValue':None, # AllowedValues,
> AnyValue, ValuesReference
> 32 },
> 33 'dataType': type(0.0),
> 34 },
> 35 ]
> 36
> 37 self.Outputs = [
> 38 #0
> 39 {
> 40 'Identifier': 'output',
> 41 'Title': 'Resulting output map',
> 42 'ComplexValueReference': {
> 43 'Formats':["text/xml"],
> 44 }
> 45 },
> 46 ]
> 47
> 48 def execute(self):
> 49 os.system("g.region -d")
> 50
> 51 os.system("v.in.ascii input=%s output=punto format=point fs=,
> skip=0 x=1 y=2 z=0 cat=0 -t 1>&2" %\
> 52 (self.Inputs[0]['point']))
> 53
> 54 os.system("v.buffer input=punto output=punto_buff type=point
> layer=1 buffer=%s scale=1.0 tolerance=0.01 1>%2" %\
> 55 (self.Inputs[1]['radius']))
> 56
> 57 os.system("v.out.ogr format=GML input=punto_buff dsn=out.xml
> olayer=point.xml 1>&2")
> 58
> 59 if "out.xml" in os.listdir(os.curdir):
> 60 self.Outputs[0]['value'] = "out.xml"
> 61 return
> 62 else:
> 63 return "Output file not created"
> >
> >
> > The error I see is this:
> >
> > /var/www/localhost/cgi-bin/pywps/processes/buffer.py
> > ", line
> > 48
> > def execute(self):
> > SyntaxError
> > :
> > invalid syntax
> > Premature end of script headers: wps.py
> >
> > Thanks for your help
> >
> > Luca
>
> Hi,
>
> there are serveral places, which could cause problem:
>
> 1) line 37 has wrong indent
> 2) same for lines 51, 54, 57
> 3) In line 57, yu have "1>%2" and IMHO it shou b' "1>&2"
> 4) definition of AnyValue for LiteralInput has changed:
>
> {
> 'Identifier': 'value',
> 'Title': 'Value to be added',
> 'LiteralValue': {'values':["*"]},
> 'dataType' : type(0.0),
> 'value':None
> },
>
> the rest looks ok.
>
> I do not know, if the line indenting is caused because of mail
> formating or not, I mentioned it just for the case
>
> 'Hope it helps
>
> Jachym
>
>
> --
> Jachym Cepicky
> e-mail: jachym.cepicky at centrum.cz
> URL: http://les-ejk.cz
> GPG: http://les-ejk.cz/gnupg_public_key/jachym_cepicky-gpg_public_key.asc
> -----------------------------------------
> OFFICE:
> Department of Geoinformation Technologies
> Zemedelska 3
> 613 00, Brno
> Czech Republick
> e-mail: xcepicky at node.mendelu.cz
> URL: http://mapserver.mendelu.cz
> Tel.: +420 545 134 514
>
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.2.2 (GNU/Linux)
>
> iD8DBQFFT0R4yKt0uAjU4I8RAhpiAKCYAVFmJfr65FmA2LBw903qjq9F4QCgwBXZ
> QOXCYgE2Q9Wj6XMOtDyllpw=
> =/4QV
> -----END PGP SIGNATURE-----
>
>
> _______________________________________________
> Pywps-devel mailing list
> Pywps-devel at wald.intevation.org
> http://lists.wald.intevation.org/mailman/listinfo/pywps-devel
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.wald.intevation.org/pipermail/pywps-devel/attachments/20061106/be3f0fcd/attachment-0001.html
More information about the Pywps-devel
mailing list