Skip to content

Workflow crashing with file not found due to strange nipype.pipeline.engine.utils.modify_path behavior #2944

Closed
@stilley2

Description

@stilley2

Summary

When getting the node results, the modify_path function will mistakenly identify some outputs as files, causing the run to fail.

Actual behavior

Workflow crashes with a file not found error due to output being mistakenly identified as a file. This occurs when the output is a string (or bytes? untested), and a file with the same name exists in the current working directory.

Expected behavior

modify_path does not identify the object as a file.

How to replicate the behavior

See below

Script/Workflow details

The following script will fail if there is a file named "22" in the directory from which it is called.

from nipype.pipeline import engine as pe
from nipype.interfaces.base import BaseInterfaceInputSpec, TraitedSpec, BaseInterface, traits


class Concat2InputSpec(BaseInterfaceInputSpec):
    x = traits.String()


class Concat2OutputSpec(TraitedSpec):
    y = traits.String()


class Concat2(BaseInterface):
    input_spec = Concat2InputSpec
    output_spec = Concat2OutputSpec

    def _run_interface(self, runtime):
        self._outval = self.inputs.x + '2'
        return runtime

    def _list_outputs(self):
        outputs = self._outputs().get()
        outputs['y'] = self._outval
        return outputs


if __name__ == '__main__':
    node = pe.Node(Concat2(x=2), 'double')
    node.run()

Please put URL to code or code here (if not too long).

Platform details:

{'commit_hash': '7fbc7cbac',
 'commit_source': 'repository',
 'networkx_version': '2.3',
 'nibabel_version': '2.4.1',
 'nipype_version': '1.2.1-dev+g7fbc7cbac',
 'numpy_version': '1.16.4',
 'pkg_path': '/home/stilley2/dev/nipype_debug/nipype/nipype',
 'scipy_version': '1.3.0',
 'sys_executable': '/home/stilley2/dev/nipype_debug/pyenv/bin/python',
 'sys_platform': 'linux',
 'sys_version': '3.7.3 (default, May 11 2019, 00:38:04) \n'
                '[GCC 9.1.1 20190503 (Red Hat 9.1.1-1)]',
 'traits_version': '5.1.1'}

Execution environment

  • My python environment outside container

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions