[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface
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 rep...@bugs.python.org http://bugs.python.org/issue22745 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface
Amaury Forgeot d'Arc added the comment: html is text, so the file mode should be 'w'. But I don't reproduce the behavior with Python version v3.4.2. Which version are you using exactly? -- nosy: +amaury.forgeotdarc ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22745 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface
R. David Murray added the comment: I don't think what html is is relevant here. Hook is going to be dealing with strings, though, so 'w' is indeed correct. The script works fine for me as well. (Also tested it on 3.3.2 since I had it laying around, so it's not a recent bugfix). -- nosy: +r.david.murray ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22745 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue22745] cgitb with Py3: TypeError: 'str' does not support the buffer interface
Wolfgang Rohdewald added the comment: This now works with mode 'w' and after reinstalling the packages. My Python is 3.4.0 (ubuntu). -- resolution: - not a bug status: open - closed ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue22745 ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com