I'm trying to run a simple matlab interface on Nipype as below, but somehow it gets stuck in run() code. My command line does not proceed anymore . But it works perfectly if I copy mlab.cmdline (matlab -nodesktop -nosplash -singleCompThread -r "addpath('/somepath');pyscript;exit") and past it to the Command Line.
import nipype.interfaces.matlab as matlab
mlab = matlab.MatlabCommand()
mlab.inputs.script = """ 1+2 """
print mlab.cmdline
res = mlab.run()
print res.runtime
here is ipython keyboard interruption :
^C---------------------------------------------------------------------------
KeyboardInterrupt Traceback (most recent call last)
/usr/lib/python2.7/dist-packages/IPython/utils/py3compat.pyc in execfile(fname, *where)
173 else:
174 filename = fname
--> 175 __builtin__.execfile(filename, *where)
/new_home/intern2012/yasin/example.py in <module>()
6
7 print mlab.cmdline
----> 8 res = mlab.run()
9
10 print res.runtime
/usr/lib/pymodules/python2.7/nipype/interfaces/base.pyc in run(self, **inputs)
944 version=self.version)
945 try:
--> 946 runtime = self._run_interface(runtime)
947 outputs = self.aggregate_outputs(runtime)
948 runtime.endTime = dt.isoformat(dt.utcnow())
/usr/lib/pymodules/python2.7/nipype/interfaces/matlab.pyc in _run_interface(self, runtime)
136 def _run_interface(self,runtime):
137 self.inputs.terminal_output = 'allatonce'
--> 138 runtime = super(MatlabCommand, self)._run_interface(runtime)
139 try:
140 # Matlab can leave the terminal in a barbbled state
/usr/lib/pymodules/python2.7/nipype/interfaces/base.pyc in _run_interface(self, runtime, correct_return_codes)
1378 setattr(runtime, 'dependencies', get_dependencies(executable_name,
1379 runtime.environ))
-> 1380 runtime = run_command(runtime, output=self.inputs.terminal_output)
1381 if runtime.returncode is None or \
1382 runtime.returncode not in correct_return_codes:
/usr/lib/pymodules/python2.7/nipype/interfaces/base.pyc in run_command(runtime, output, timeout)
1150 result['merged'] = [r[1] for r in temp]
1151 if output == 'allatonce':
-> 1152 stdout, stderr = proc.communicate()
1153 result['stdout'] = stdout.split('\n')
1154 result['stderr'] = stderr.split('\n')
/usr/lib/python2.7/subprocess.pyc in communicate(self, input)
752 return (stdout, stderr)
753
--> 754 return self._communicate(input)
755
756
/usr/lib/python2.7/subprocess.pyc in _communicate(self, input)
1310
1311 if _has_poll:
-> 1312 stdout, stderr = self._communicate_with_poll(input)
1313 else:
1314 stdout, stderr = self._communicate_with_select(input)
/usr/lib/python2.7/subprocess.pyc in _communicate_with_poll(self, input)
1364 while fd2file:
1365 try:
-> 1366 ready = poller.poll()
1367 except select.error, e:
1368 if e.args[0] == errno.EINTR:
I have read other subprocess problems in this site but they all are related with Popen(). In my case something wrong with poller.poll(). It does not process anymore when it reaches this line.