← 输入框|github.com|刷新
Skip to content

CLI fails when retrieving single file #141

Closed

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')

Activity

  1. added
    bug
    good first issue
    on Dec 10, 2024
  2. effigies commented on Aug 12, 2025

    @effigies
    Contributor

    Closed by #140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issue

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions