diff options
author | Markus Heiser <markus.heiser@darmarit.de> | 2021-04-26 11:36:35 +0200 |
---|---|---|
committer | Markus Heiser <markus.heiser@darmarit.de> | 2021-04-26 12:55:26 +0200 |
commit | 1a402be175e20d27cb3c6d9b0c23dd4aaedc5c85 (patch) | |
tree | 9b995fa59df2264965b39cbe854d7354b5f447ec /searx | |
parent | 51494849fc821fb9ef3d3738d96a86c4d48a5ca3 (diff) | |
download | searxng-1a402be175e20d27cb3c6d9b0c23dd4aaedc5c85.tar.gz searxng-1a402be175e20d27cb3c6d9b0c23dd4aaedc5c85.zip |
[fix] debug log: UnicodeEncodeError: 'ascii' codec can't encode
The issue exists only in the debug log::
--- Logging error ---
Traceback (most recent call last):
File "/usr/lib/python3.9/logging/__init__.py", line 1086, in emit
stream.write(msg + self.terminator)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 79-89: ordinal not in range(128)
Call stack:
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 2464, in __call__
return self.wsgi_app(environ, start_response)
File "/usr/local/searx/searx-src/searx/webapp.py", line 1316, in __call__
return self.app(environ, start_response)
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/werkzeug/middleware/proxy_fix.py", line 169, in __call__
return self.app(environ, start_response)
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 2447, in wsgi_app
response = self.full_dispatch_request()
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 1950, in full_dispatch_request
rv = self.dispatch_request()
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask/app.py", line 1936, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/searx/searx-src/searx/webapp.py", line 766, in search
number_of_results=format_decimal(number_of_results),
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask_babel/__init__.py", line 458, in format_decimal
locale = get_locale()
File "/usr/local/searx/searx-pyenv/lib/python3.9/site-packages/flask_babel/__init__.py", line 226, in get_locale
rv = babel.locale_selector_func()
File "/usr/local/searx/searx-src/searx/webapp.py", line 249, in get_locale
logger.debug("%s uses locale `%s` from %s", request.url, locale, locale_source)
Unable to print the message and arguments - possible formatting error.
Use the traceback above to help find the error.
Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx')
-rwxr-xr-x | searx/webapp.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/searx/webapp.py b/searx/webapp.py index 69ec915a7..70d2d662b 100755 --- a/searx/webapp.py +++ b/searx/webapp.py @@ -54,6 +54,7 @@ from datetime import datetime, timedelta from timeit import default_timer from html import escape from io import StringIO +import urllib from urllib.parse import urlencode, urlparse from pygments import highlight @@ -246,7 +247,10 @@ def get_locale(): request.form['use-translation'] = 'oc' locale = 'fr_FR' - logger.debug("%s uses locale `%s` from %s", request.url, locale, locale_source) + logger.debug( + "%s uses locale `%s` from %s", urllib.parse.quote(request.url), locale, locale_source + ) + return locale |