request.exceptions.ConnectionError :(“连接已中止。”,错误(2,“没有此类文件或目录”))

时间:2018-10-29 08:52:05

标签: python flask

当我从命令行运行Python程序时发生以下错误:

File "manager/start_server.py", line 6, in <module>
    from manager.responses import start_response
  File "/home/rj/dlruijie/slave-server/manager/responses.py", line 20, in <module>
    CONTAINER_OBJ = Containers()
  File "/home/rj/dlruijie/slave-server/manager/node.py", line 157, in __init__
    self.client.version()
  File "/usr/lib/python2.7/site-packages/docker/client.py", line 171, in version
    return self.api.version(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/docker/api/daemon.py", line 159, in version
    return self._result(self._get(url), json=True)
  File "/usr/lib/python2.7/site-packages/docker/utils/decorators.py", line 47, in inner
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 183, in _get
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 521, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 508, in request
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 618, in send
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 490, in send
    raise ConnectionError(err, request=request)
requests.exceptions.ConnectionError: ('Connection aborted.', error(2, 'No such file or directory'))

它经常发生。但是,当我第一次将程序放到服务器上时,我没有这个错误。

1 个答案:

答案 0 :(得分:0)

我相信您可能正在运行可能连接另一个服务(数据库访问或其他容器服务)的容器,该服务只能从该环境访问,而不能从本地环境访问。