[Mapit] genmap.fcgi doesn't return images
Moritz Lenz
moritz at casella.verplant.org
Mon Feb 12 13:56:24 CET 2007
Hi,
Bernhard Herzog wrote:
> Moritz Lenz <moritz at casella.verplant.org> writes:
>
>>>> File "/home/moritz/public_html/mapit/makemap.py", line 78, in
>>>> generate_map image = PIL.Image.new("RGB", (result_width, result_height),
>>>> 0xFFFFFFFF) File "/usr/lib/python2.4/site-packages/PIL/Image.py", line
>>>> 1610, in new return Image()._new(core.fill(mode, size, color))
>>>> SystemError: new style getargs format but argument is not a tuple
>>>>
>>>> Any idea what might be wrong?
>>> The problems seems to arise from PIL somehow.
> [...]
>> Oddly enough it works when I start genmap explictly with python-2.3
>> instead of 2.4, so I'll try to fall back to pyhton2.3.
>
> The issue is probably that 0xFFFFFFFF is a long-int in Python 2.4 while
> it was an int in Python 2.3. PIL accepts an int as a color
> specification for RGB images. But a long-int is a different python
> type, and so PIL tries to interpret the long-int object as a tuple which
> leads to the error message above. A simple fix would be to replace the
> 0xFFFFFFFF with -1. 0x00FFFFFF would probably also work.
It works in the sense that I can run genmap from the command line with
python2.4, but I still get the same errors in error.log, and a 501 when
calling genmap.fcgi from the browser:
[Mon Feb 12 10:43:09 2007] [warn] FastCGI: (dynamic) server
"/var/www/mapit/genmap.fcgi" has failed to remain running for 30 seconds
given 3 attempts, its restart interval has been backed off to 600 seconds
I wonder if "dynamic" is the right mode to run genmap? If I understood
that right there are three modes to run fast-cgi scripts, do I have to
choose a particular mode?
Anyway, I wrote a small test script (with code stolen from genmap.fcgi)
to see if fast-cgi generally works for me, and it does.
Best regards,
Moritz
P.S. this is the test program that works fine as fast-cgi script.
#! /usr/bin/python -O
import os, sys
import socket
import fcgi
def main():
while(1):
try:
while fcgi.isFCGI():
req = fcgi.FCGI()
print "Content-Type: text/plain"
print
print "Something"
req.Finish()
except socket.error:
continue
except Exception:
break
main()
--
Moritz Lenz
http://moritz.faui2k3.org/
http://sudokugarden.de/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://www.intevation.de/pipermail/mapit/attachments/20070212/5e37680d/signature.asc
More information about the Mapit
mailing list
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)