rpuga
rpuga
JJanusGraph
Created by rpuga on 11/17/2023 in #questions
Unable to use next() in gremlin-python
Hi, has anyone tried to use gremlin-python with janusgraph 1.0.0? It seems that there is a bug that makes next() unusable. Here is an example of how to reproduce the issue:
# Python 3.10.12
# janusgraph 1.0.0
# gremlinpython==3.7.0

from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

connection = DriverRemoteConnection("ws://jgserver:8182/gremlin", "g")
g = traversal().withRemote(connection)

g.V().drop().iterate()
g.E().drop().iterate()
v1 = g.addV('vertex').property('name', 'v1').next()
# Python 3.10.12
# janusgraph 1.0.0
# gremlinpython==3.7.0

from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection

connection = DriverRemoteConnection("ws://jgserver:8182/gremlin", "g")
g = traversal().withRemote(connection)

g.V().drop().iterate()
g.E().drop().iterate()
v1 = g.addV('vertex').property('name', 'v1').next()
This generates a KeyError:
[...]

~/.local/lib/python3.10/site-packages/gremlin_python/structure/io/graphbinaryV1.py in read_object(self, b)
192 return self.to_object(io.BytesIO(b))
193 elif isinstance(b, io.BufferedIOBase):
--> 194 return self.to_object(b)
195
196 def to_object(self, buff, data_type=None, nullable=True):

~/.local/lib/python3.10/site-packages/gremlin_python/structure/io/graphbinaryV1.py in to_object(self, buff, data_type, nullable)
201 buff.read(1)
202 return None
--> 203 return self.deserializers[DataType(bt)].objectify(buff, self, nullable)
204 else:
205 return self.deserializers[data_type].objectify(buff, self, nullable)

KeyError: <DataType.custom: 0>
[...]

~/.local/lib/python3.10/site-packages/gremlin_python/structure/io/graphbinaryV1.py in read_object(self, b)
192 return self.to_object(io.BytesIO(b))
193 elif isinstance(b, io.BufferedIOBase):
--> 194 return self.to_object(b)
195
196 def to_object(self, buff, data_type=None, nullable=True):

~/.local/lib/python3.10/site-packages/gremlin_python/structure/io/graphbinaryV1.py in to_object(self, buff, data_type, nullable)
201 buff.read(1)
202 return None
--> 203 return self.deserializers[DataType(bt)].objectify(buff, self, nullable)
204 else:
205 return self.deserializers[data_type].objectify(buff, self, nullable)

KeyError: <DataType.custom: 0>
Using g.addV('vertex').property('name', 'v1').iterate() instead of next() works fine. Any thoughts?
14 replies