From 96cc3f64bd173aa6336e05d7fb12db6977b4a201 Mon Sep 17 00:00:00 2001 From: Anatoli Babenia Date: Wed, 29 Jul 2020 12:02:02 +0300 Subject: [PATCH] Install `bash` and fix Python3 subprocess bytes File "/app/lib/globals.py", line 25, in error if not text.startswith("Too many queries"): TypeError: startswith first arg must be bytes or a tuple of bytes, not str --- Dockerfile | 2 +- lib/frontend/html.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6b1c35f..c0a461b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -14,6 +14,6 @@ RUN mkdir -p /root/.cheat.sh/log/ \ && python3 lib/fetch.py fetch-all # installing server dependencies -RUN apk add --update --no-cache py3-jinja2 py3-flask +RUN apk add --update --no-cache py3-jinja2 py3-flask bash ENTRYPOINT ["python3"] CMD ["bin/srv.py"] diff --git a/lib/frontend/html.py b/lib/frontend/html.py index 9c63120..c73e96c 100644 --- a/lib/frontend/html.py +++ b/lib/frontend/html.py @@ -84,7 +84,7 @@ def _render_html(query, result, editable, repository_button, topics_list, reques data = data.encode('utf-8') stdout, stderr = proc.communicate(data) if proc.returncode != 0: - error(stdout + stderr) + error((stdout + stderr).decode('utf-8')) return stdout.decode('utf-8')