[mapserver-users] Python MapScript via WSGI examples

Jeff McKenna jmckenna at gatewaygeomatics.com
Fri Jul 15 14:46:24 PDT 2016


Hi Tom,

I believe I have your test working here, on Windows with mod_wsgi, 
Python 3.5.1, and MapScript7.  Googling your error I believe your header 
problem occurs just for Python2 responses (maybe both Julien and I are 
using Python3 ?)  What happens if you try to force the content-type to 
utf8 ?  Change line#40 to:

   start_response('200 OK', [('Content-type', 'text/html; charset=utf-8')])

Just a guess as I have Python3.  A try anyway...

-jeff


-- 
Jeff McKenna
MapServer Consulting and Training Services
http://www.gatewaygeomatics.com/




On 2016-07-15 3:05 PM, Kralidis, Tom (EC) wrote:
> Thanks Julien and Stephan: I've updated my example in [1], however I get
> the following traceback when issuing a WMS 1.1.1 GetMap request:
>
> Traceback (most recent call last):
>   File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
>     self.result = application(self.environ, self.start_response)
>   File "mapscript-wsgi.py", line 40, in application
>     start_response('200 OK', [('Content-type', content_type)])
>   File "/usr/lib/python2.7/wsgiref/handlers.py", line 180, in start_response
>     assert type(val) is StringType,"Header values must be strings"
> AssertionError: Header values must be string
>
> Any idea?
>
> ..Tom
>
> [1] https://gist.github.com/tomkralidis/9adbd4864c03647aa7eb4f96a3c33297
>






More information about the MapServer-users mailing list