From c27805b4e718091eeed35c9922fec5867dd58a93 Mon Sep 17 00:00:00 2001 From: OzzieIsaacs Date: Tue, 10 Apr 2018 18:50:04 +0200 Subject: [PATCH] Bugfix Updater python3 Bugfix Updater in case of error --- cps/helper.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cps/helper.py b/cps/helper.py index 37d213c9..237f8981 100755 --- a/cps/helper.py +++ b/cps/helper.py @@ -13,6 +13,7 @@ import os import traceback import re import unicodedata +from io import BytesIO try: from StringIO import StringIO @@ -386,7 +387,7 @@ class Updater(threading.Thread): r = requests.get('https://api.github.com/repos/janeczku/calibre-web/zipball/master', stream=True) fname = re.findall("filename=(.+)", r.headers['content-disposition'])[0] self.status = 2 - z = zipfile.ZipFile(StringIO(r.content)) + z = zipfile.ZipFile(BytesIO(r.content)) self.status = 3 tmp_dir = gettempdir() z.extractall(tmp_dir) @@ -481,7 +482,7 @@ class Updater(threading.Thread): if change_permissions: try: os.chown(dst_file, permission.st_uid, permission.st_gid) - except Exception: + except (Exception) as e: # ex = sys.exc_info() old_permissions = os.stat(dst_file) logging.getLogger('cps.web').debug('Fail change permissions of ' + str(dst_file) + '. Before: '