Skip to content

Commit 0e575a4

Browse files
authored
Merge pull request #158 from Haitham-ghaida/fix_data_store
Resolve "Too Many Open Files" Error by Managing ZipFS Resources
2 parents 8055a3d + 5a933df commit 0e575a4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

bw2data/data_store.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,9 @@ def filepath_processed(self):
161161
return self.dirpath_processed() / self.filename_processed()
162162

163163
def datapackage(self):
164-
return load_datapackage(ZipFS(self.filepath_processed()))
164+
zip_file_path = self.filepath_processed()
165+
with ZipFS(zip_file_path) as zip_fs:
166+
return load_datapackage(zip_fs)
165167

166168
def write(self, data, process=True):
167169
"""Serialize intermediate data to disk.

0 commit comments

Comments
 (0)