gremlin python help with next() toList()

305 views
Skip to first unread message

Debasish Kanhar

unread,
Sep 27, 2017, 10:57:20 AM9/27/17
to Gremlin-users
Hi,

I had a normal enviorenment of Gremlin Python + JanusGraph setup few days back, and my connection to JanusGraph was working like a charm. 

Now, I tried running basic queries, but it fails. Descriptions is as follows:

I start Cassandra & Elastic search. Then start bin/gremlin-server.sh

From python client I do the following:

from gremlin_python.structure.graph import Graph
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
url_for_graph
= 'ws://{}:{}/gremlin'.format("127.0.0.1", "8182")
graph
= Graph()
g
= graph.traversal().withRemote(DriverRemoteConnection(url_for_graph, 'g'))
print(g.V().valueMap().next())

I got following traceback:
Traceback (most recent call last):
  File "/share/janusgraph-0.1.1-hadoop2/debasish/CodeBase/DataPreparation/DataPreparation.py", line 216, in <module>
    print(g.V().valueMap().next())
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 65, in next
    return self.__next__()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 38, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 277, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/remote_connection.py", line 75, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 53, in submit
    traversers = self._loop.run_sync(lambda: self.submit_traversal_bytecode(request_id, bytecode))
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 453, in run_sync
    return future_cell[0].result()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 282, in wrapper
    yielded = next(result)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 69, in submit_traversal_bytecode
    "gremlin": self._graphson_writer.writeObject(bytecode),
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/structure/io/graphson.py", line 70, in writeObject
    return json.dumps(GraphSONWriter._dictify(objectData), separators=(',', ':'))
TypeError: 'separators' is an invalid keyword argument for this function


I realized this error is because of ujson. So I uninstalled ujson and ran again but this time a new error poped up.
Traceback (most recent call last):
  File "/share/janusgraph-0.1.1-hadoop2/debasish/CodeBase/DataPreparation/DataPreparation.py", line 216, in <module>
    print(g.V().valueMap().next())
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 65, in next
    return self.__next__()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 38, in __next__
    self.traversal_strategies.apply_strategies(self)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/process/traversal.py", line 277, in apply_strategies
    traversal_strategy.apply(traversal)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/remote_connection.py", line 75, in apply
    remote_traversal = self.remote_connection.submit(traversal.bytecode)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 53, in submit
    traversers = self._loop.run_sync(lambda: self.submit_traversal_bytecode(request_id, bytecode))
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/ioloop.py", line 453, in run_sync
    return future_cell[0].result()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 73, in submit_traversal_bytecode
    traversers = yield self._execute_message(message)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1014, in run
    yielded = self.gen.throw(*exc_info)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 149, in _execute_message
    recv_message = yield response.receive()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1008, in run
    value = future.result()
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/concurrent.py", line 232, in result
    raise_exc_info(self._exc_info)
  File "<string>", line 3, in raise_exc_info
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/tornado/gen.py", line 1017, in run
    yielded = self.gen.send(value)
  File "/home/prjadmin/anaconda3/lib/python3.6/site-packages/gremlin_python/driver/driver_remote_connection.py", line 229, in receive
    results.append(self._graphson_reader.toObject(item))
AttributeError: 'GraphSONReader' object has no attribute 'toObject'


The same set of errors were reported for .next() as well as .toList().

Did anything specific change in internal working of those methods in last few weeks? Or something I'm missing out on.

If required, do I need to attach my .properties, .yaml files? Or do I need to do clean setup?

Thanks

Debasish Kanhar

unread,
Sep 27, 2017, 11:02:01 AM9/27/17
to Gremlin-users
Adding to above points. the same issue can't be reproduced by executing queries by connecting gremlin server from bin/gremlin.sh

Robert Dale

unread,
Sep 27, 2017, 11:46:51 AM9/27/17
to gremli...@googlegroups.com
Did you upgrade gremlin-python? Make sure you're using the right version which should be 3.2.3 for janusgraph-0.1.

Robert Dale

--
You received this message because you are subscribed to the Google Groups "Gremlin-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/gremlin-users/01ee883a-cc7b-48a5-8871-0a6d4134a8c2%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Debasish Kanhar

unread,
Sep 28, 2017, 3:59:12 AM9/28/17
to Gremlin-users
Thanks for the input. I solved the issue yesterday itself. The issue was because somehow Tornado got updated from 4.1 to 4.3 and it was failing.

Robert Dale

To unsubscribe from this group and stop receiving emails from it, send an email to gremlin-user...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages