微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

python与azure gremlin的集成不起作用

如何解决python与azure gremlin的集成不起作用

我正在尝试模仿 GIT 中提到的。

我几乎评论了所有内容,只是想简单地运行

g.V().count()

我的连接详细信息是正确的,并且与文档匹配...

我收到以下错误

Traceback (most recent call last):
  File "c:\Users\PraSarak\OneDrive\gremlin_azure_function\connect.py",line 193,in <module>
    count_vertices(client)
  File "c:\Users\PraSarak\OneDrive\gremlin_azure_function\connect.py",line 116,in count_vertices
    callback = client.submit(_gremlin_count_vertices)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\gremlin_python\driver\client.py",line 127,in submit
    return self.submitAsync(message,bindings=bindings,request_options=request_options).result()
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\gremlin_python\driver\client.py",line 148,in submitAsync
    return conn.write(message)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\gremlin_python\driver\connection.py",line 55,in write
    self.connect()
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\gremlin_python\driver\connection.py",line 45,in connect
    self._transport.connect(self._url,self._headers)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\gremlin_python\driver\tornado\transport.py",line 40,in connect
    self._ws = self._loop.run_sync(
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\ioloop.py",line 576,in run_sync
    return future_cell[0].result()
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\simple_httpclient.py",line 269,in run
    stream = yield self.tcp_client.connect(
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\gen.py",line 1133,in run
    value = future.result()
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\gen.py",line 1147,in run
    yielded = self.gen.send(value)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\tcpclient.py",line 232,in connect
    af,addr,stream = yield connector.start(connect_timeout=timeout)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\tcpclient.py",line 87,in start
    self.try_connect(iter(self.primary_addrs))
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\tcpclient.py",line 104,in try_connect
    stream,future = self.connect(af,addr)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\tcpclient.py",line 276,in _create_stream
    return stream,stream.connect(addr)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\iostream.py",line 1325,in connect
    self._add_io_state(self.io_loop.WRITE)
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\iostream.py",line 1157,in _add_io_state
    self.io_loop.add_handler(
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\site-packages\tornado\platform\asyncio.py",line 83,in add_handler
    self.asyncio_loop.add_writer(
  File "C:\Users\PraSarak\Miniconda3\envs\learn-gremlin\lib\asyncio\events.py",line 507,in add_writer
    raise NotImplementedError
NotImplementedError

解决方法

我想我得到了答案。

问题在于 python 3.8 和 Tornado 兼容性,当涉及到 asyncio 时。

更多信息在此link

修复是在 tornado/platform/asyncio.py 中添加以下行

asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())  # python-3.8.0a4

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。