[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface

Wolfgang Rohdewald report at bugs.python.org
Mon Oct 27 19:41:35 CET 2014


New submission from Wolfgang Rohdewald:

The attached script works with Python2.7. With Python3.4, it produces

Traceback (most recent call last):
  File "/usr/lib/python3.4/cgitb.py", line 268, in __call__
    self.handle((etype, evalue, etb))
  File "cgibug.py", line 12, in handle
    cgitb.Hook.handle(self, info)
  File "/usr/lib/python3.4/cgitb.py", line 273, in handle
    self.file.write(reset())
TypeError: 'str' does not support the buffer interface

When replacing the file mode 'wb' with 'w', it produces this failure:
  File "/usr/lib/python3.4/cgitb.py", line 288, in handle
    self.file.write(doc + '\n')
TypeError: can't concat bytes to str

The script works as expected with Python2.7 with both file modes.

----------
components: Library (Lib)
files: cgibug.py
messages: 230083
nosy: wrohdewald
priority: normal
severity: normal
status: open
title: cgitb with Py3: TypeError: 'str' does not support the buffer interface
type: crash
versions: Python 3.4
Added file: http://bugs.python.org/file37043/cgibug.py

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22745>
_______________________________________


More information about the Python-bugs-list mailing list