Skip to content

Commit 94e9e49

Browse files
committed
Catch non-existing model file
1 parent fed8217 commit 94e9e49

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

src/imcflibs/imagej/shading.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
from ..imagej import bioformats # pylint: disable-msg=no-name-in-module
88
from ..imagej import projections
9+
from ..imagej import misc
910
from ..pathtools import listdir_matching, gen_name_from_orig
1011
from ..log import LOG as log
1112

@@ -130,7 +131,11 @@ def process_folder(path, suffix, outpath, model_file, fmt):
130131
model = None
131132
else:
132133
model = ij.IJ.openImage(model_file)
133-
model.show() # required, otherwise the IJ.run() call ignores the model
134+
# the model needs to be shown, otherwise the IJ.run() call ignores it
135+
try:
136+
model.show()
137+
except AttributeError:
138+
misc.error_exit("Opening shading model [%s] failed!" % model_file)
134139

135140
matching_files = listdir_matching(path, suffix)
136141
log.info("Running shading correction and projections on %s files...",

0 commit comments

Comments
 (0)