Fix ResourceWarning (#520)

This commit is contained in:
Ceesjan Luiten
2020-11-05 14:47:41 +01:00
committed by GitHub
parent bbdf15a6ec
commit e837dac26a

View File

@@ -81,7 +81,8 @@ def extract_django_settings_module(config_file_path: Optional[str]) -> str:
parser = configparser.ConfigParser()
try:
parser.read_file(open(cast(str, config_file_path)), source=config_file_path)
with open(cast(str, config_file_path)) as handle:
parser.read_file(handle, source=config_file_path)
except (IsADirectoryError, OSError):
exit(1)