From 9b52d6cb28d17e35beda0906b77f16796bc3cffd Mon Sep 17 00:00:00 2001 From: Ubuntu Date: Wed, 27 May 2020 15:17:20 +0000 Subject: [PATCH] Added with statement to close file before returning --- .../management/commands/create_or_update_site_configuration.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/openedx/core/djangoapps/site_configuration/management/commands/create_or_update_site_configuration.py b/openedx/core/djangoapps/site_configuration/management/commands/create_or_update_site_configuration.py index edcb0f19a4..3fc92844b9 100644 --- a/openedx/core/djangoapps/site_configuration/management/commands/create_or_update_site_configuration.py +++ b/openedx/core/djangoapps/site_configuration/management/commands/create_or_update_site_configuration.py @@ -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):