aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sos/policies/__init__.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/sos/policies/__init__.py b/sos/policies/__init__.py
index d004e9f2..651abc6c 100644
--- a/sos/policies/__init__.py
+++ b/sos/policies/__init__.py
@@ -768,10 +768,11 @@ any third party.
for preset_path in os.listdir(presets_path):
preset_path = os.path.join(presets_path, preset_path)
- try:
- preset_data = json.load(open(preset_path))
- except ValueError:
- continue
+ with open(preset_path) as pf:
+ try:
+ preset_data = json.load(pf)
+ except ValueError:
+ continue
for preset in preset_data.keys():
pd = PresetDefaults(preset, opts=SoSOptions())