From daca13f08203664df9dd37437579d7b5fe637650 Mon Sep 17 00:00:00 2001 From: Matt J Madsen Date: Tue, 30 Aug 2016 04:27:03 -0500 Subject: [PATCH] Fix for #4718 (#4924) * Add except variable * Add except variable --- pokemongo_bot/cell_workers/telegram_task.py | 2 +- pokemongo_bot/inventory.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pokemongo_bot/cell_workers/telegram_task.py b/pokemongo_bot/cell_workers/telegram_task.py index f9c421aff5..c5bdd2ae58 100644 --- a/pokemongo_bot/cell_workers/telegram_task.py +++ b/pokemongo_bot/cell_workers/telegram_task.py @@ -102,7 +102,7 @@ def _get_player_stats(self): try: with open(web_inventory, "r") as infile: json_inventory = json.load(infile) - except ValueError: + except ValueError as e: # Unable to read json from web inventory # File may be corrupt. Create a new one. self.bot.logger.info('[x] Error while opening inventory file for read: %s' % e) diff --git a/pokemongo_bot/inventory.py b/pokemongo_bot/inventory.py index d4a2efc5f3..461de2b6f7 100644 --- a/pokemongo_bot/inventory.py +++ b/pokemongo_bot/inventory.py @@ -1211,7 +1211,7 @@ def update_web_inventory(self): try: with open(web_inventory, "w") as outfile: json.dump(json_inventory, outfile) - except (IOError, ValueError): + except (IOError, ValueError) as e: self.bot.logger.info('[x] Error while opening inventory file for write: %s' % e, 'red') pass except: