I have a very simple problem. I am reading data from a file and
displaying the content on the web page. The issue I am facing is that
I have some non-ascii data in the files. As a result I am getting
the following error below. Can you point out how to resolve this.


2010-01-04 22:07:55,914 cherrypy.msg INFO HTTP: Page handler: <bound
method Root
.fileinfo of <deceptive.controllers.Root object at 0x0374E2F0>>
Traceback (most recent call last):
  File "D:\Python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy
\_cphttpt
ools.py", line 121, in _run
    self.main()
  File "D:\Python25\lib\site-packages\cherrypy-2.3.0-py2.5.egg\cherrypy
\_cphttpt
ools.py", line 264, in main
    body = page_handler(*virtual_path, **self.params)
  File "<string>", line 3, in fileinfo
  File "D:\Python25\lib\site-packages\turbogears-1.0.4.3-py2.5.egg
\turbogears\co
ntrollers.py", line 363, in expose
    *args, **kw)
  File "<string>", line 5, in run_with_transaction
  File "D:\Python25\lib\site-packages\turbogears-1.0.4.3-py2.5.egg
\turbogears\da
tabase.py", line 356, in so_rwt
    retval = func(*args, **kw)
  File "<string>", line 5, in _expose
  File "D:\Python25\lib\site-packages\turbogears-1.0.4.3-py2.5.egg
\turbogears\co
ntrollers.py", line 378, in <lambda>
    mapping, fragment, args, kw)))
  File "D:\Python25\lib\site-packages\turbogears-1.0.4.3-py2.5.egg
\turbogears\co
ntrollers.py", line 418, in _execute_func
    return _process_output(output, template, format, content_type,
mapping, frag
ment)
  File "D:\Python25\lib\site-packages\turbogears-1.0.4.3-py2.5.egg
\turbogears\co
ntrollers.py", line 86, in _process_output
    fragment=fragment)
  File "D:\Python25\lib\site-packages\turbogears-1.0.4.3-py2.5.egg
\turbogears\vi
ew\base.py", line 129, in render
    return engine.render(**kw)
  File "D:\Python25\lib\site-packages\turbokid-1.0.4-py2.5.egg\turbokid
\kidsuppo
rt.py", line 206, in render
    output=output, format=format)
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\__init__.py", line
 301, in serialize
    raise_template_error(module=self.__module__)
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\__init__.py", line
 299, in serialize
    return serializer.serialize(self, encoding, fragment, format)
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\serialization.py",
 line 107, in serialize
    text = ''.join(self.generate(stream, encoding, fragment, format))
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\serialization.py",
 line 629, in generate
    for ev, item in self.apply_filters(stream, format):
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\serialization.py",
 line 165, in format_stream
    for ev, item in stream:
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\parser.py", line 2
21, in _coalesce
    for ev, item in stream:
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\serialization.py",
 line 477, in inject_meta_tags
    for ev, item in stream:
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\parser.py", line 1
79, in _track
    for p in stream:
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\filter.py", line 3
2, in apply_matches
    item = stream.expand()
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\parser.py", line 1
08, in expand
    for ev, item in self._iter:
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\parser.py", line 1
79, in _track
    for p in stream:
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\parser.py", line 2
29, in _coalesce
    text += to_unicode(value, encoding)
  File "D:\Python25\lib\site-packages\kid-0.9.6-py2.5.egg\kid
\parser.py", line 2
06, in to_unicode
    return unicode(value, encoding)
UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position
249: unexpec
ted code byte
Error in code generated from template file 'D:\\Python25\\Deceptive\
\deceptive\\
templates\\fileinfo.kid'

 - - "GET /fileinfo?filename=obama_hotel.txt HTTP/1.1" 500 791 "http://
stevens.n
o-ip.biz/displayresults?" "Mozilla/4.0 (compatible; MSIE 8.0; Windows
NT 6.0; Tr
ident/4.0; DS_gamingharbor; GTB6.3;
desktopsmiley_3_1_6426568112130306_421_915;
SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.1; .NET CLR
3.5.21022;
.NET CLR 3.5.30729; .NET CLR 3.0.30618)"

--

You received this message because you are subscribed to the Google Groups 
"TurboGears" group.
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/turbogears?hl=en.


Reply via email to