Skip to content
Snippets Groups Projects
Unverified Commit 24bc2686 authored by Ned Batchelder's avatar Ned Batchelder Committed by GitHub
Browse files

Merge pull request #24068 from eduNEXT/defz/3521-resourcewarning-unclosed-file

Added 'with' statement to close file before returning
parents a88da3b5 9b52d6cb
Branches
Tags release-2020-05-26-15.05
No related merge requests found
......@@ -17,7 +17,8 @@ LOG = logging.getLogger(__name__)
def load_json_from_file(filename):
return json.load(codecs.open(filename, encoding='utf-8'))
with codecs.open(filename, encoding='utf-8') as file:
return json.load(file)
class Command(BaseCommand):
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment