Skip to content

Commit

Permalink
Fix error message for multiple paths
Browse files Browse the repository at this point in the history
  • Loading branch information
pvandyken committed Feb 20, 2024
1 parent 0c404d5 commit b9a5443
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
10 changes: 6 additions & 4 deletions snakebids/core/input_generation.py
Original file line number Diff line number Diff line change
Expand Up @@ -636,10 +636,12 @@ def _get_component(
path = itx.one(paths)
except ValueError as err:
msg = (
f"More than one snakemake filename for {input_name}, taking the "
f"first. To correct this, use the --filter_{input_name} option to "
f"narrow the search. Found filenames: {paths}"
)
f"Multiple path templates for one component. Use --filter_{input_name} to "
f"narrow your search or --wildcards_{input_name} to make the template more "
"generic.\n"
f"\tcomponent = {input_name!r}\n"
f"\tpath_templates = [\n\t\t" + ",\n\t\t".join(map(repr, paths)) + "\n\t]\n"
).expandtabs(4)
raise ConfigError(msg) from err

if filters.has_empty_postfilter:
Expand Down
7 changes: 3 additions & 4 deletions snakebids/paths/_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,9 @@ def bids(
result = os.path.join(*path_parts) + tail
if custom_parts and _implicit and not in_interactive_session():
wrn_msg = (
f"Path generated with custom entities not part of the default BIDS "
"spec, and a spec has not been explicitly declared. This could break "
"when snakebids is upgraded, as the default spec can be updated "
"without warning, and these entities may be included in future specs.\n"
f"Path generated with unrecognized entities, and a snakebids spec has "
"not been explicitly declared. This could break in future snakebids "
"versions, as the default spec can be changed without warning.\n"
f"\tpath = {result!r}\n"
f"\tentities = {custom_parts!r}\n\n"
"Please declare a spec using:\n"
Expand Down

0 comments on commit b9a5443

Please sign in to comment.