Skip to content

Commit

Permalink
close the file after reading in JSONVocabulary.get_list()
Browse files Browse the repository at this point in the history
  • Loading branch information
aperrin66 committed Feb 13, 2020
1 parent 2bc775f commit f38907c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pythesint/json_vocabulary.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@ def get_list(self):
''' Read list from JSON '''
if not os.path.exists(self.get_filepath()):
self.update()
return self.sort_list(json.load(open(self.get_filepath())))
f = open(self.get_filepath())
result = json.load(f)
f.close()
return self.sort_list(result)

def update(self):
''' Write vocabulary to a JSON file '''
Expand Down

0 comments on commit f38907c

Please sign in to comment.