mlab icon indicating copy to clipboard operation
mlab copied to clipboard

mlab.matlabpipe.MatlabConnectionError: timeout

Open ruozhichen opened this issue 8 years ago • 4 comments

When I executed the following commands, trying to call matlab function, it failed and the error trace is given at the end. from mlab.releases import latest_release as matlab matlab.plot([1,2,3,4,5],-'o')

It happened in Ubuntu. And I tested mlab in Windows before, it succeeded. So I don't know why it doesn't work in Ubuntu, I try to solve it but found nothing, I will be appreciated If anyone has some suggestions. If you have solved it before or know this error, please tell me.

Error:
File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 607, in mlab_command return self._do(name, *args, **update({'nout':nout}, kwargs)) File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 547, in _do res = self._get_values(resSL) File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 483, in _get_values res.append(self._get(varname)) File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 568, in _get vartype = self._var_type(varname) File "/usr/local/lib/python2.7/site-packages/mlab/mlabwrap.py", line 436, in var_type res_type = mlabraw.get(self.session, "TMP_CLS") File "/usr/local/lib/python2.7/site-packages/mlab/mlabraw.py", line 72, in get return matlab.get(var_name) File "/usr/local/lib/python2.7/site-packages/mlab/matlabpipe.py", line 250, in get self._read_until('start_binary\n', on_new_output=on_new_output) File "/usr/local/lib/python2.7/site-packages/mlab/matlabpipe.py", line 294, in _read_until raise MatlabConnectionError('timeout') mlab.matlabpipe.MatlabConnectionError:timeout.

ruozhichen avatar Apr 20 '17 08:04 ruozhichen

@ruozhichen HI, have you solved this problem ? I face the same problem.

jimmy-dq avatar May 20 '17 15:05 jimmy-dq

@handworker
Sorry,I still not find a solution. However, I use another way to call matlab from python. You can choose matlab engine for python. install: http://cn.mathworks.com/help/matlab/matlab_external/install-the-matlab-engine-for-python.html how to call matlab script: http://cn.mathworks.com/help/matlab/matlab_external/call-user-script-and-function-from-python.html Hope this could help you.

ruozhichen avatar May 23 '17 03:05 ruozhichen

@ruozhichen Thanks!

jimmy-dq avatar May 23 '17 06:05 jimmy-dq

I've run into this problem as well, and, in my case, it was because the function I was calling was running into an error, and therefore never returned. This caused the pipe to never find the ___MATLAB_PIPE_COMMAND_ENDED___ terminator it was waiting for, and thus, the timeout message.

I diagnosed the problem my adding print "output_tail: %s" % (output_tail) just before this line so I could see exactly what was going on.

I'd suggest that the fix is to modify that _read_until function to look for errors and to throw an exception if one is returned.

andrewminer avatar Jan 04 '18 20:01 andrewminer