Skip to content

Commit a1c7a22

Browse files
Li Xucp2boston
authored andcommitted
ISSUE-74: close file after reading (#75)
1 parent b1eb390 commit a1c7a22

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

rosette/api.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,8 @@ def load_document_file(self, path):
226226
"""
227227
self.use_multipart = True
228228
self.file_name = path
229-
self.load_document_string(open(path, "rb").read())
229+
with open(path, "rb") as f:
230+
self.load_document_string(f.read())
230231

231232
def load_document_string(self, content_as_string):
232233
"""Loads a string into the object.

0 commit comments

Comments
 (0)