Browse Source

Correction du warning sur la non fermeture du fichier json du quel est chargé le ME

Driky 9 years ago
parent
commit
b94f867764
1 changed files with 2 additions and 2 deletions
  1. 2
    2
      EditorialModel/backend/json_backend.py

+ 2
- 2
EditorialModel/backend/json_backend.py View File

@@ -44,8 +44,8 @@ class EmBackendJson(object):
44 44
     #
45 45
     # @param json_file str: path to the json_file used as data source
46 46
     def __init__(self, json_file):
47
-        json_data = open(json_file).read()
48
-        self.data = json.loads(json_data)
47
+        with open(json_file).read() as json_data:
48
+            self.data = json.loads(json_data)
49 49
 
50 50
     ## Loads the data in the data source json file
51 51
     #

Loading…
Cancel
Save