Skip to content

Commit e36f375

Browse files
committed
Update patients_database.py
1 parent bba2f9a commit e36f375

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

delia/databases/patients_database.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def __init__(
5353
self.path_to_database = path_to_database
5454

5555
if os.path.exists(path_to_database):
56-
self._file = h5py.File(path_to_database, mode="r+")
56+
try:
57+
self._file = h5py.File(path_to_database, mode="r+")
58+
except OSError:
59+
self._file = h5py.File(path_to_database, mode="r")
5760
else:
5861
self._file = None
5962

@@ -315,7 +318,10 @@ def create(
315318
patients_data_extractor.close()
316319
patients_data_extractor.reset()
317320

318-
self._file = h5py.File(self.path_to_database, "r+")
321+
try:
322+
self._file = h5py.File(self.path_to_database, mode="r+")
323+
except OSError:
324+
self._file = h5py.File(self.path_to_database, mode="r")
319325

320326
return patients_data_extractor.patients_who_failed
321327

0 commit comments

Comments
 (0)