GitLab will be upgraded on June 23rd evening. During the upgrade the service will be unavailable, sorry for the inconvenience.

Commit 9e52fbf7 authored by Pierre Paleo's avatar Pierre Paleo

Use logging instead of print

parent 6b745d1d
......@@ -27,7 +27,7 @@ __authors__ = ["W. de Nolf"]
__license__ = "MIT"
__date__ = "25/08/2020"
import logging
import h5py
from tomoscan.utils import SharedLockPool
import os
......@@ -36,7 +36,7 @@ import traceback
import errno
HASSWMR = h5py.version.hdf5_version_tuple >= h5py.get_config().swmr_min_hdf5_version
_logger = logging.getLogger(__name__)
class HDF5File(h5py.File):
"""File to secure reading and writing within h5py
......@@ -147,7 +147,7 @@ def check_virtual_sources_exist(fname, data_path):
"""
with HDF5File(fname, "r") as f:
if data_path not in f:
print("No dataset %s in file %s" % (data_path, fname))
_logger.error("No dataset %s in file %s" % (data_path, fname))
return False
dptr = f[data_path]
if not dptr.is_virtual:
......@@ -157,9 +157,9 @@ def check_virtual_sources_exist(fname, data_path):
os.path.dirname(dptr.file.filename), vsource.file_name
)
if not os.path.isfile(vsource_fname):
print("No such file: %s" % vsource_fname)
_logger.error("No such file: %s" % vsource_fname)
return False
elif not check_virtual_sources_exist(vsource_fname, vsource.dset_name):
print("Error with virtual source %s" % vsource_fname)
_logger.error("Error with virtual source %s" % vsource_fname)
return False
return True
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