Skip to content

Instantly share code, notes, and snippets.

@chrisgorgo
Created November 19, 2015 20:26
Show Gist options
  • Select an option

  • Save chrisgorgo/0cd489059434389d3c71 to your computer and use it in GitHub Desktop.

Select an option

Save chrisgorgo/0cd489059434389d3c71 to your computer and use it in GitHub Desktop.
Try to replicate nipype bug
orange:nipype_test filo$ ./test.py
orange:nipype_test filo$ ls -al /tmp/was_run
-rw-r--r-- 1 filo wheel 0 Nov 19 12:21 /tmp/was_run
orange:nipype_test filo$ rm -rf /tmp/was_run
orange:nipype_test filo$ python simple_interface.py
gzip test.txt
orange:nipype_test filo$ ls -al /tmp/was_run
ls: /tmp/was_run: No such file or directory
from nipype.interfaces.base import (
TraitedSpec,
CommandLineInputSpec,
CommandLine,
File
)
import os
class GZipInputSpec(CommandLineInputSpec):
input_file = File(desc="File", exists=True, mandatory=True, argstr="%s")
class GZipOutputSpec(TraitedSpec):
output_file = File(desc = "Zip file", exists = True)
class GZipTask(CommandLine):
input_spec = GZipInputSpec
output_spec = GZipOutputSpec
cmd = 'gzip'
def _list_outputs(self):
outputs = self.output_spec().get()
outputs['output_file'] = os.path.abspath(self.inputs.input_file + ".gz")
return outputs
if __name__ == '__main__':
zipper = GZipTask(input_file='test.txt')
print zipper.cmdline
zipper.run()
#!/usr/bin/env python
open("/tmp/was_run", "w").close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment