From ce32c8d5dd12b2fd0cd4ac78d52ccc087aff7bf4 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 8 Dec 2021 12:40:43 +0000 Subject: [PATCH 1/2] improve error message if reader nott available Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com> --- monai/transforms/io/array.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/monai/transforms/io/array.py b/monai/transforms/io/array.py index cd2d93a0c7..76d457da25 100644 --- a/monai/transforms/io/array.py +++ b/monai/transforms/io/array.py @@ -204,6 +204,8 @@ def __call__(self, filename: Union[Sequence[PathLike], PathLike], reader: Option break if img is None or reader is None: + if isinstance(filename, tuple) and len(filename) == 0: + filename = filename[0] raise RuntimeError( f"can not find a suitable reader for file: {filename}.\n" " Please install the reader libraries, see also the installation instructions:\n" From 8624f8c1d2b4d1db1853c692b7684b7a8523b2b7 Mon Sep 17 00:00:00 2001 From: Richard Brown <33289025+rijobro@users.noreply.github.com> Date: Wed, 8 Dec 2021 15:53:40 +0000 Subject: [PATCH 2/2] correct error Signed-off-by: Richard Brown <33289025+rijobro@users.noreply.github.com> --- monai/transforms/io/array.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monai/transforms/io/array.py b/monai/transforms/io/array.py index 76d457da25..47017dad39 100644 --- a/monai/transforms/io/array.py +++ b/monai/transforms/io/array.py @@ -204,10 +204,10 @@ def __call__(self, filename: Union[Sequence[PathLike], PathLike], reader: Option break if img is None or reader is None: - if isinstance(filename, tuple) and len(filename) == 0: + if isinstance(filename, tuple) and len(filename) == 1: filename = filename[0] raise RuntimeError( - f"can not find a suitable reader for file: {filename}.\n" + f"cannot find a suitable reader for file: {filename}.\n" " Please install the reader libraries, see also the installation instructions:\n" " https://docs.monai.io/en/latest/installation.html#installing-the-recommended-dependencies.\n" f" The current registered: {self.readers}.\n"