From 32e7c4411559e8780ad48ea5e05cf77d6a131e89 Mon Sep 17 00:00:00 2001 From: vincent Date: Wed, 31 Jan 2018 22:26:34 +0100 Subject: [PATCH] correction bug si fichier jsin n'existe pas --- chaineTV.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/chaineTV.py b/chaineTV.py index f0092d8..f5b2e05 100644 --- a/chaineTV.py +++ b/chaineTV.py @@ -67,8 +67,13 @@ class Interface: def load_jsonfile(file): - with open(file, 'r', encoding='utf-8') as f: - return json.load(f) + try: + with open(file, 'r', encoding='utf-8') as f: + return json.load(f) + except FileNotFoundError: + parsechaine(file) + with open(file, 'r', encoding='utf-8') as f: + return json.load(f) def RepresentsInt(s): try: