[Python-modules-team] Bug#888603: python3-paste: errormiddleware fails with write() argument must be str, not bytes when exception trapped
Alternative admin
bugs at perusal.info
Sat Jan 27 16:16:05 UTC 2018
Package: python3-paste
Version: 2.0.3+dfsg-4
Severity: important
Dear Maintainer,
I am using Paste's ErrorMiddleware to trap exceptions in a WSGI based
app. running under Apache mod_wsgi eg
from paste.exceptions.errormiddleware import ErrorMiddleware
.....
application = ErrorMiddleware(application, debug=True)
With this in place normal use of my application is fine. However, if my
application throws an exception, instead of the expected diagnostic
screen I get a 500 - Server error.
The Apache error log shows
AssertionError
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File
"/usr/lib/python3/dist-packages/paste/exceptions/errormiddleware.py",
line 154, in __call__
response = self.exception_handler(exc_info, environ)
File
"/usr/lib/python3/dist-packages/paste/exceptions/errormiddleware.py",
line 188, in exception_handler
simple_html_error=simple_html_error)
File
"/usr/lib/python3/dist-packages/paste/exceptions/errormiddleware.py",
line 391, in handle_exception
error_stream.write(line)
TypeError: write() argument must be str, not bytes
The firstline above is the error forced in my app, the rest is in the
middeware.
I have found another report of this on the Internet but no solution -
https://stackoverflow.com/questions/44792287/why-does-paste-errormiddleware-throw-an-exception-when-i-use-it-with-my-python-3
Regards
Tony Middleton
-- System Information:
Debian Release: 9.3
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 4.9.0-5-amd64 (SMP w/1 CPU core)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), LANGUAGE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
Versions of packages python3-paste depends on:
ii python3 3.5.3-1
ii python3-pkg-resources 33.1.1-1
ii python3-six 1.10.0-3
ii python3-tempita 0.5.2-2
Versions of packages python3-paste recommends:
ii libjs-mochikit 1.4.2-4
ii python3-openssl 16.2.0-1
Versions of packages python3-paste suggests:
pn libapache2-mod-python <none>
pn libapache2-mod-scgi <none>
ii libapache2-mod-wsgi-py3 [httpd-wsgi] 4.5.11-1
pn python3-pastedeploy <none>
-- no debconf information
More information about the Python-modules-team
mailing list