Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
tomotools
tomoscan
Commits
9e52fbf7
Commit
9e52fbf7
authored
Mar 29, 2021
by
Pierre Paleo
Browse files
Use logging instead of print
parent
6b745d1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
tomoscan/io.py
View file @
9e52fbf7
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment