Open JohannesWiesner opened 1 year ago
Yes. One of the functions of Node
s is isolation so that your CWD doesn't influence the behavior of tools. You will want to use absolute paths here.
@effigies Alright thanks! I wonder if one could adapt the Error message for this case as tmp/tmprbnvs25y/model_specifier/functional2.nii
is a symbolic link pointing to an existing file so I couldn't really understanding what's going on.
Perhaps one could implement a method within the Node()
class that checks if the provided paths are absolute or relative and throw an error for the latter case. One could use os.path.isabs() for example.
Relative paths are frequently used for output filenames. I don't think we could make it an error without breaking that use case.
You could dig through the traceback and find where we make the inputs absolute, and put that in a try
/catch
block and provide a better error message than the more opaque TraitError
.
I should note though that Nipype 1 is in maintenance mode and it will probably die by the time Python 3.11 hits end-of-life. In my opinion, a better use of time would be to work to improve Pydra and write Task
s (which replaces Interface
s and Node
s) to cover your use cases.
Summary
This issue is potentially related to #3301. I would like to use
nipype.algorithms.modelgen.SpecifySPMModel
to set up my design matrix. I noticed that the class itself is able to handle relative filepaths for its argumentfunctional_runs
, but not when being inside a node. Is this an expected behavior?How to replicate the behavior
Actual behavior
model_specifier.run()
results inTraitError: Each element of the 'functional_runs' trait of a SpecifySPMModelInputSpec instance must be a list of items which are a pathlike object or string representing an existing file or a pathlike object or string representing an existing file, but a value of '/tmp/tmprbnvs25y/model_specifier/functional2.nii' <class 'str'> was specified.
Expected behavior
As a user I would expect that
model_specifier.run()
should run successfully just likes.run()
, because the only difference between the first and the second case is that the latter is packed inside a Node, everything else is the same. One can fix this byNode(SpecifySPMModel(functional_runs=...)
with absolute paths like such:But as a user I would not expect to do this,
Script/Workflow details
Please put URL to code or code here (if not too long).
Platform details:
Execution environment
Choose one