Skip to content

Commit 85d7603

Browse files
committed
Open file properly
1 parent 1541bf0 commit 85d7603

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

readthedocs/doc_builder/python_environments.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,11 @@ def is_obsolete(self):
128128
return False
129129

130130
try:
131-
environment_conf = json.load(self.environment_json_path())
131+
with open(self.environment_json_path(), 'r') as fpath:
132+
environment_conf = json.load(fpath)
132133
env_python_version = Version(environment_conf['python']['version'])
133134
env_build_image = Version(environment_conf['build']['image'])
134-
except (TypeError, KeyError, json.decoder.JSONDecodeError):
135+
except (TypeError, KeyError, ValueError):
135136
return False
136137

137138
# If the user define the Python version just as a major version

0 commit comments

Comments
 (0)