I´m having an very strange UnicodeDecodeError on the following program.
The most strange is that before start the application the same formatting
instruction works, it raises the error only inside the GET (or any other
controller method).
The test program is:
==============================
#!/usr/bin/python
# -*- coding: utf-8 -*-
import os
import sys
import web
class Index(object):
def GET(self, id = None):
if id:
# this raises UnicodeDecodeError
msg = 'Não encontrado: %s' % web.ctx.path
raise web.notfound(msg)
return 'Encontrei'
urls = (
'/(.*)', 'Index'
)
application = web.application(urls, globals())
# this works
msg = 'Não encontrado: %s' % '/test'
web.debug(msg)
if __name__=='__main__':
application.run()
==============================
The log message generated on server is:
==============================
beppler@squeeze:~/site$ python test.py
'N\xc3\xa3o encontrado: /test'
http://0.0.0.0:8080/
'N\xc3\xa3o encontrado: /test'
Traceback (most recent call last):
File "/home/beppler/Projects/elco/src/web/application.py", line 239, in
process
return self.handle()
File "/home/beppler/Projects/elco/src/web/application.py", line 230, in
handle
return self._delegate(fn, self.fvars, args)
File "/home/beppler/Projects/elco/src/web/application.py", line 462, in
_delegate
return handle_class(cls)
File "/home/beppler/Projects/elco/src/web/application.py", line 438, in
handle_class
return tocall(*args)
File "/home/beppler/Projects/elco/src/site/test.py", line 17, in GET
msg = 'Não encontrado: %s' % web.ctx.path
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
ordinal not in range(128)
==============================
--
You received this message because you are subscribed to the Google Groups
"web.py" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/webpy/-/0BaEIWjIKAAJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/webpy?hl=en.