【问题标题】:ConnectionRefusedError when trying to connect to Gremlin Server using Python尝试使用 Python 连接到 Gremlin 服务器时出现 ConnectionRefusedError
【发布时间】:2018-06-14 19:02:09
【问题描述】:

我正在尝试将 gremlin 与带有 gremlinpython 包的 python 一起使用。我收到以下错误。谁能告诉我如何解决这个问题?任何帮助表示赞赏。

Traceback (most recent call last):
      File "C:/Users/Yash/IdeaProjects/new/gremlin.py", line 10, in <module>
        g = graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\driver_remote_connection.py", line 45, in __init__
        password=password)
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\client.py", line 76, in __init__
        self._fill_pool()
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\client.py", line 88, in _fill_pool
        conn = self._get_connection()
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\client.py", line 101, in _get_connection
        self._transport_factory, self._executor, self._pool)
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\connection.py", line 40, in __init__
        self.connect()
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\connection.py", line 46, in connect
        self._transport.connect(self._url)
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\gremlin_python\driver\tornado\transport.py", line 33, in connect
        lambda: websocket.websocket_connect(url))
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\ioloop.py", line 458, in run_sync
        return future_cell[0].result()
      File "C:\Users\Yash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\tornado\concurrent.py", line 238, in result
        raise_exc_info(self._exc_info)
      File "<string>", line 4, in raise_exc_info
    ConnectionRefusedError: [Errno 10061] Unknown error

【问题讨论】:

  • 你正在执行什么导致错误的代码?
  • 这是代码: 1.from gremlin_python import statics 2.from gremlin_python.structure.graph import Graph 3. from gremlin_python.process.graph_traversal import __ 4. from gremlin_python.process.strategies import * 5 . from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection 6. graph = Graph() g = 7. graph.traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))
  • 错误状态为“连接被拒绝”,那么您确定 Gremlin Server 是在 8182 上本地运行的吗?如果您认为是,您可以使用 Gremlin 控制台连接到它进行验证吗? tinkerpop.apache.org/docs/current/reference/…
  • 我改写了您的问题标题,使其更加明确和 SEO 友好
  • 谢谢@jbmusso,感谢您的帮助。

标签: python gremlin


【解决方案1】:

检查您的配置,将主机设置为 ip 而不是主机名

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2019-08-10
  • 2016-10-05
  • 1970-01-01
  • 2018-10-07
  • 2016-01-22
  • 2020-10-04
  • 1970-01-01
  • 2023-04-02
相关资源
最近更新 更多