Skip to content

Commit 015976f

Browse files
authored
Merge pull request #36 from lutraconsulting/ResourceWarning_fix
ResourceWarning: unclosed file fix by use with
2 parents 7815aa3 + a0188de commit 015976f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mergin/client.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,9 @@ def get_list_of_push_changes(self, push_changes):
338338
result_file = self.fpath("change_list" + str(idx), self.meta_dir)
339339
try:
340340
self.geodiff.list_changes_summary(changeset, result_file)
341-
change = open(result_file, "r").read()
342-
changes[file["path"]] = json.loads(change)
341+
with open(result_file, 'r') as f:
342+
change = f.read()
343+
changes[file["path"]] = json.loads(change)
343344
os.remove(result_file)
344345
except (pygeodiff.GeoDiffLibError, pygeodiff.GeoDiffLibConflictError):
345346
pass

0 commit comments

Comments
 (0)