Skip to content

CLI fails when retrieving single file #141

@mgxd

Description

@mgxd
$ templateflow get MNIInfant --cohort 1 --resolution 1 --suffix T1w
Traceback (most recent call last):
  File "/Users/mathiasg/.pyenv/versions/nipreps/bin/templateflow", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/mathiasg/.pyenv/versions/3.11.9/envs/nipreps/lib/python3.11/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mathiasg/.pyenv/versions/3.11.9/envs/nipreps/lib/python3.11/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/mathiasg/.pyenv/versions/3.11.9/envs/nipreps/lib/python3.11/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mathiasg/.pyenv/versions/3.11.9/envs/nipreps/lib/python3.11/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mathiasg/.pyenv/versions/3.11.9/envs/nipreps/lib/python3.11/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mathiasg/.pyenv/versions/3.11.9/envs/nipreps/lib/python3.11/site-packages/templateflow/cli.py", line 149, in get
    '\n'.join(f'{match}' for match in api.get(template, **entities))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: 'PosixPath' object is not iterable

but using the client directly

In [1]: import templateflow.api as tf

In [2]: tf.get('MNIInfant', cohort=1, resolution=1, suffix='T1w')
Out[2]: PosixPath('/Users/mathiasg/.cache/templateflow/tpl-MNIInfant/cohort-1/tpl-MNIInfant_cohort-1_res-1_T1w.nii.gz')

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomers

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions