小编Sam*_*rth的帖子

无法使用gremlinpython查询

gremlinpython用来访问Janusgraph中的数据,但是它抛出异常,而可以从Gremlin Shell访问数据。

这是我正在远程运行的Python代码:

from gremlin_python import statics
from gremlin_python.structure.graph import Graph
from gremlin_python.process.graph_traversal import __
from gremlin_python.process.strategies import *
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

graph = Graph()
g = graph.traversal().withRemote(DriverRemoteConnection('ws://<IP>:8182/gremlin','g', 
username="janusgraph"))
print g.V().has('name', 'saturn').next()
Run Code Online (Sandbox Code Playgroud)

这是我得到的例外:

Traceback (most recent call last):
  File "test.py", line 10, in <module>
    print g.V().has('name', 'saturn').next()
  File "/root/venv/lib/python2.7/site-packages/gremlin_python/process/traversal.py", line 70, in next
    return self.__next__()
  File "/root/venv/lib/python2.7/site-packages/gremlin_python/process/traversal.py", line 43, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/root/venv/lib/python2.7/site-packages/gremlin_python/process/traversal.py", line 346, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/root/venv/lib/python2.7/site-packages/gremlin_python/driver/remote_connection.py", line 143, in apply
    remote_traversal = …
Run Code Online (Sandbox Code Playgroud)

python gremlin gremlin-server janusgraph

5
推荐指数
1
解决办法
1227
查看次数

标签 统计

gremlin ×1

gremlin-server ×1

janusgraph ×1

python ×1