pylons-0.8.2 FastCGI Unicode HTML: write() argument must be string

27 views
Skip to first unread message

Chris....@gmail.com

unread,
Aug 30, 2006, 2:33:25 PM8/30/06
to pylons-discuss
We've been developing an app in pylons-0.8.2 and are going to pilot
it, using Apache to front it wit FastCGI. (we'll upgrade to 0.9 after
our pilot phase but can't right now). I've gotten the dispatch.cgi
working per the Wiki docs but having problems when Pylons (?) tries to
render.

It looks like the HTML that's built is returned as Unicode and the
write() expects a plain str type. Check the line after 1118 below.

Any idea why we're getting Unicode, and how to fix? We've seen
something like this before which I'll be posting on separately.

Thanks.


/usr/local/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py
in run(self=<flup.server.fcgi_base.Request object>)
556 """Runs the handler, flushes the streams, and ends the
request."""
557 try:
558 protocolStatus, appStatus =
self.server.handler(self)
559 except:
560 traceback.print_exc(file=self.stderr)
protocolStatus undefined, appStatus undefined, self =
<flup.server.fcgi_base.Request object>, self.server =
<flup.server.fcgi.WSGIServer object>, self.server.handler = <bound
method WSGIServer.handler of <flup.server.fcgi.WSGIServer object>>


/usr/local/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py
in handler(self=<flup.server.fcgi.WSGIServer object>,
req=<flup.server.fcgi_base.Request object>)
1114 for data in result:
1115 if data:
1116 write(data)
1117 if not headers_sent:
1118 write('') # in case body was empty
write = <function write>, data = u'\n\n\n\n\n\n <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML ... </div>\n\n \n </div>\n</body>\n\n</html>\n'


/usr/local/lib/python2.4/site-packages/flup-0.5-py2.4.egg/flup/server/fcgi_base.py
in write(data=u'\n\n\n\n\n\n <!DOCTYPE html PUBLIC "-//W3C//DTD
XHTML
... </div>\n\n \n </div>\n</body>\n\n</html>\n')
1056
1057 def write(data):
1058 assert type(data) is str, 'write() argument must be
string'
1059 assert headers_set, 'write() before
start_response()'
1060
builtin type = <type 'type'>, data = u'\n\n\n\n\n\n <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML ... </div>\n\n \n
</div>\n</body>\n\n</html>\n', builtin str = <type 'str'>

AssertionError: write() argument must be string
args = ('write() argument must be string',)

Reply all
Reply to author
Forward
0 new messages