Commit 690cf466 authored by Thomas Vincent's avatar Thomas Vincent
Browse files

Avoid h5py deprecation warning

parent b30abfe8
......@@ -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):
......
Markdown is supported
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