From 47b30bbf0ae0bdf359938df58145b6824db6af83 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 18 Sep 2024 16:15:16 -0400 Subject: [PATCH] BF(workaround): if heuristic provided just a string and not list of types -- make it a tuple Closes #786 --- heudiconv/convert.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/heudiconv/convert.py b/heudiconv/convert.py index aecc70dc..ec5639c6 100644 --- a/heudiconv/convert.py +++ b/heudiconv/convert.py @@ -562,6 +562,15 @@ def convert( for item in items: prefix, outtypes, item_dicoms = item + if isinstance(outtypes, str): # type: ignore[unreachable] + lgr.warning( # type: ignore[unreachable] + "Provided output types %r of type 'str' instead " + "of a tuple for prefix %r. Likely need to fix-up your heuristic. " + "Meanwhile we are 'manually' converting to 'tuple'", + outtypes, + prefix, + ) + outtypes = (outtypes,) prefix_dirname = op.dirname(prefix) outname_bids = prefix + ".json" bids_outfiles = []