gremlin-python - How can I avoid "Unclosed Client Session" when exiting my program?

Viewed 378

Problem

I have followed the simple example provided in gremlin-python instructions and did run:

from gremlin_python.process.anonymous_traversal import traversal
from gremlin_python.driver.driver_remote_connection import DriverRemoteConnection
g = traversal().withRemote(DriverRemoteConnection('ws://localhost:8182/gremlin','g'))

But then my main closed I get the following error message:

Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x00000134D79FB070>

How can I avoid getting this message?

1 Answers

Solution

The close method is in the object returned by DriverRemoteConnection(). Obtain the object to DriverRemoteConnection() and then perform the close operation when you are ready to close it.

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

connection = DriverRemoteConnection('ws://localhost:8182/gremlin','g')
g = traversal().withRemote(connection)
connection.close()
Related