Skip to content

"TraitError: Each element of the 'in_files' trait of a SmoothInputSpec instance must be a pathlike object or string representing an existing file #3616

Open
@stepantikhomirov

Description

@stepantikhomirov

Hello experts,
I've faced this error
"TraitError: Each element of the 'in_files' trait of a SmoothInputSpec instance must be a pathlike object or string representing an existing file, but a value of '/data/Stepan_Tikhomirov/EPIsoDE/rawdata/sub-ZI004/ses-03/func/sub-ZI004_ses-03_task-faces_run-01_bold.nii.gz' <class 'str'> was specified."
when running this code

import nipype.interfaces.spm as spm
smooth = spm.Smooth()
smooth.inputs.in_files = '/data/Stepan_Tikhomirov/EPIsoDE/rawdata/sub-ZI004/ses-03/func/sub-ZI004_ses-03_task-faces_run-01_bold.nii.gz'
smooth.inputs.fwhm = [4, 4, 4]
smooth.run() 

I am sure that this file exists, as I checked it with

from nipype.utils.filemanip import Path
Path('/data/Stepan_Tikhomirov/EPIsoDE/rawdata/sub-ZI004/ses-03/func/sub-ZI004_ses-03_task-faces_run-01_bold.nii.gz').exists()
Out[3]: True

I also used os.exists() and it found this file as well. In addition, I applied different fsl tools (isotropic smooth, for example) to this file and it worked properly. Thus, fsl works, but not spm. What can be the reason?

To give you some more context, Firstly, I activated my environment, then loaded matlab/R2023a, spm12/9.14 and FSL/6.0.6.4. After that I opened spyder from the bash. I can't understand ii it is a nipype problem, compatibility of spm or something else.

Thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions