Catch errors on loading pickle file

Fix for cover images without Pillow
This commit is contained in:
Ozzieisaacs
2019-04-18 21:17:59 +02:00
parent 89516fc2d6
commit 67736fe187
3 changed files with 25 additions and 8 deletions
+8 -3
View File
@@ -201,9 +201,14 @@ lm.anonymous_user = ub.Anonymous
app.secret_key = os.getenv('SECRET_KEY', 'A0Zr98j/3yX R~XHH!jmN]LWX/,?RT')
db.setup_db()
with open(os.path.join(config.get_main_dir, 'cps/translations/iso639.pickle'), 'rb') as f:
language_table = cPickle.load(f)
try:
with open(os.path.join(config.get_main_dir, 'cps/translations/iso639.pickle'), 'rb') as f:
language_table = cPickle.load(f)
except cPickle.UnpicklingError as error:
app.logger.error("Can't read file cps/translations/iso639.pickle: %s", error)
print("Can't read file cps/translations/iso639.pickle: %s" % error)
helper.global_WorkerThread.stop()
sys.exit(1)
def is_gdrive_ready():
return os.path.exists(os.path.join(config.get_main_dir, 'settings.yaml')) and \