Commit c55f69d7 authored by Thomas Vincent's avatar Thomas Vincent
Browse files

Merge branch 'h5py-deprecation' into 'master'

Avoid h5py deprecation warning

Closes #82

See merge request !128
parents 204a5515 690cf466
Pipeline #27127 passed with stages
in 21 minutes and 28 seconds
......@@ -125,7 +125,15 @@ class XsocsH5Base(object):
You MUST call :meth:`close` for each call to this method
"""
if self.__file is None:
self.__file = _h5py.File(self.__h5_f, self.mode)
if self.mode is not None:
self.__file = _h5py.File(self.__h5_f, self.mode)
else:
# Behavior close to h5py 2.x default mode:
# Try RW first then RO mode
try:
self.__file = _h5py.File(self.__h5_f, mode='a')
except IOError:
self.__file = _h5py.File(self.__h5_f, mode='r')
self.__file_count += 1
def close(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment