From 20fa9f55234dc1c9b526c933aef03e47351d817f Mon Sep 17 00:00:00 2001 From: Ozzie Isaacs Date: Mon, 12 Jul 2021 17:33:35 +0200 Subject: [PATCH] Fix encoding errors on windows while downloading logbooks --- cps/debug_info.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/cps/debug_info.py b/cps/debug_info.py index cfa549f9..dd5e858e 100644 --- a/cps/debug_info.py +++ b/cps/debug_info.py @@ -22,10 +22,6 @@ import glob import zipfile import json from io import BytesIO -try: - from StringIO import StringIO -except ImportError: - from io import StringIO import os @@ -38,9 +34,9 @@ log = logger.create() def assemble_logfiles(file_name): log_list = sorted(glob.glob(file_name + '*'), reverse=True) - wfd = StringIO() + wfd = BytesIO() for f in log_list: - with open(f, 'r') as fd: + with open(f, 'rb') as fd: shutil.copyfileobj(fd, wfd) wfd.seek(0) if int(__version__.split('.')[0]) < 2: