arokem / python-matlab-bridge

A simple Python => MATLAB(R) interface and a matlab_magic for ipython
BSD 2-Clause "Simplified" License
335 stars 96 forks source link

Mac os x: socket.timeout: timed out #234

Open Paul-Darius opened 8 years ago

Paul-Darius commented 8 years ago

Hello and thanks for this great project, I am running it on mac os x yosemite. Sometimes, it works perfectly fine, but in some other moments I face this issue:

>>> from pymatbridge import Matlab
>>> mlab = Matlab("/Applications/MATLAB_R2015a.app/bin/matlab")
>>> mlab.start()
Starting MATLAB
sh: ./pymatbridge/logs/bashlog_python-matlab-bridge.txt: No such file or directory
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/paul-dariussarmadi/Documents/python-matlab-bridge/pymatbridge/__init__.py", line 38, in start
    while not self.is_connected():
  File "/Users/paul-dariussarmadi/Documents/python-matlab-bridge/pymatbridge/__init__.py", line 60, in is_connected
    resp = self._open_page('test_connect.m', {'id': self.id})
  File "/Users/paul-dariussarmadi/Documents/python-matlab-bridge/pymatbridge/__init__.py", line 92, in _open_page
    page = urllib2.urlopen('%s/%s' % (self.server, page_name), urllib.urlencode(arguments), timeout)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 154, in urlopen
    return opener.open(url, data, timeout)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 431, in open
    response = self._open(req, data)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 449, in _open
    '_open', req)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 409, in _call_chain
    result = func(*args)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1227, in http_open
    return self.do_open(httplib.HTTPConnection, req)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/urllib2.py", line 1200, in do_open
    r = h.getresponse(buffering=True)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 1136, in getresponse
    response.begin()
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 453, in begin
    version, status, reason = self._read_status()
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 409, in _read_status
    line = self.fp.readline(_MAXLINE + 1)
  File "/usr/local/Cellar/python/2.7.11/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 480, in readline
    data = self._sock.recv(self._rbufsize)
socket.timeout: timed out

And in some other moments I have this:

>>> mlab = Matlab(matlab='/Applications/MATLAB_R2015a.app/bin/matlab')
>>> mlab.start()
Starting MATLAB
...still starting up...
...still starting up...
...still starting up...
...still starting up...
...still starting up...

(never stopping). Do you have any idea what I should do? Thanks a lot for your help

arokem commented 8 years ago

Do you have any sense for when you get these kinds of issues? What is different about these times, relative to times when it works fine?

Paul-Darius commented 8 years ago

That is precisely the problem, I have no idea. Rarely it works, generally I have the "still starting up" message which never ends. And in this last scenario, most of the time I also have this message:

sh: ./pymatbridge/logs/bashlog_python-matlab-bridge.txt: No such file or directory