Issue #1278 invalid

CherryPy tries to .encode bytes when setting a custom error response page

LThode
created an issue
Traceback (most recent call last):
  File "/home/kb1rd/dscanotron/testenv3/lib/python3.3/site-packages/CherryPy-3.2.4-py3.3.egg/cherrypy/_cprequest.py", line 664, in respond
    inst.set_response()
  File "/home/kb1rd/dscanotron/testenv3/lib/python3.3/site-packages/CherryPy-3.2.4-py3.3.egg/cherrypy/_cperror.py", line 376, in set_response
    message=self._message).encode('utf-8')
AttributeError: 'bytes' object has no attribute 'encode'

Easiest way to reproduce this is to do anything that makes CherryPy go off and format a custom error page, while running under Python 3, of course.

Comments (2)

  1. LThode reporter

    Sorry, false alarm! Turns out it was an issue in my code that was causing custom error page handlers to return bytes. Easy fix: make them return Unicode instead.

  2. Log in to comment