Connection issue via py2neo not working

driver

(Geert Schneider) #1

Hi,

I have a perfectly working python/neo4j/py2neo setup on a personal laptop - everythin installed via anaconda.
I'm trying the same setup on my corporate environment - so fresh install of anaconda + install of the py2neo package but there I get following issue on making a call to perform any neo4j operation.

I've created a Graph object by calling >>> graph = Graph(password="neo4jagain")

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\py2neo\graph.py", line 457, in delete_all
self.run("MATCH (a) DETACH DELETE a")
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\py2neo\graph.py", line 654, in run
return self.begin(autocommit=True).run(statement, parameters, **kwparameters)
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\py2neo\graph.py", line 380, in begin
return Transaction(self, autocommit)
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\py2neo\graph.py", line 804, in init
self.session = driver.session()
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\neo4j\v1\bolt.py", line 51, in session
return BoltSession(self.pool.acquire(self.address))
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\neo4j\bolt\connection.py", line 459, in acquire
connection = self.connector(address)
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\neo4j\v1\bolt.py", line 46, in
pool = ConnectionPool(lambda a: connect(a, security_plan.ssl_context, **config))
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\neo4j\bolt\connection.py", line 615, in connect
return Connection(s, der_encoded_server_certificate=der_encoded_server_certificate, **config)
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\neo4j\bolt\connection.py", line 256, in init
self.buffering_socket = BufferingSocket(self)
File "C:\Users\GSCHNEID\Anaconda3\lib\site-packages\neo4j\bolt\connection.py", line 99, in init
self.address = Address(*self.socket.getpeername())
TypeError: new() takes 3 positional arguments but 5 were given

Any suggestion ?


(Nigel Small) #2

That's definitely an IPv6 problem. Internally, Python stores an IPv4 address in a 2-tuple and an IPv6 address in a 4-tuple.

I seem to recall fixing this a while ago, though I can't remember in exactly which version of the driver (which is where the stack trace leads). And I'm only on my phone right now so can't check.

Best guess is that something needs updating, as I'm pretty sure this should work with IPv6. But I'll check properly later. As a workaround, force an IPv4 address into your connection URI.


(Geert Schneider) #3

Hi Nigel,

thanks a lot for your response !
No worry - I'm not under time pressure for this.

I was not specifying any URL at all as by default it uses localhost, and as I have neo4j running in a container that is perfect.

When playing with the connection string however it solved the issue by putting "127.0.0.1". Strange if you ask me, but for sure there is a good explenation for it.

Thanks again for your advice!