diff --git a/config.yaml b/config.yaml index 4f29245..ee862b8 100644 --- a/config.yaml +++ b/config.yaml @@ -1,2 +1,3 @@ folders: - extensions +- tests/assets diff --git a/src/AuDaGe/__main__.py b/src/AuDaGe/__main__.py index 0929393..5aabf4a 100644 --- a/src/AuDaGe/__main__.py +++ b/src/AuDaGe/__main__.py @@ -111,11 +111,11 @@ def convert(args): input_subs = yaml.safe_load(args.input_subs) output_subs = yaml.safe_load(args.output_subs) input_converter = Converter(input_format_path, input_subs) - input_frame = input_converter.from_file(args.input_file.resolve()) + input_frame = input_converter.from_file(find_file(args.input_file)) af = input_converter.to_AF(input_frame) output_converter = Converter(output_format_path, output_subs) output_frame = output_converter.from_AF(af) - output_converter.to_file(output_frame, args.output_file.resolve()) + output_converter.to_file(output_frame, args.output_file) def list_configs(): diff --git a/src/AuDaGe/file_utilities.py b/src/AuDaGe/file_utilities.py index 5ebfddf..a52caf4 100644 --- a/src/AuDaGe/file_utilities.py +++ b/src/AuDaGe/file_utilities.py @@ -14,16 +14,18 @@ def find_file( filepath: PathLike | Path | str, folders: Collection[Path] = () ) -> Path: path = Path(filepath) - allfolders = chain( - [] if folders is None else folders, - [Path(getcwd())], - AuDaGe.folders, + allfolders = list( + chain( + [] if folders is None else folders, + [Path(getcwd())], + AuDaGe.folders, + ) ) for folder in allfolders: fullpath = Path(folder, path).resolve() if fullpath.exists(): return fullpath raise FileNotFoundError( - f"The file {filepath} was not found in any of the configured folders " - f"({allfolders})." + f'The file "{filepath}" was not found in any of the configured ' + f"folders: {', '.join([str(path) for path in allfolders])}." )