Skip to content

Unable to connect due a unexpected return value of socket.getpeername() #129

@dmanchon

Description

@dmanchon

Hi, I have an issue connecting with the database using bolt, dont know if i am doing something wrong, the details of the issue are:

Versions:

  • python: 3.5.2
  • neo4j-python-driver: 1.1.0
  • neo4j: 3.1.0

Code:

from neo4j.v1 import GraphDatabase, basic_auth
driver = GraphDatabase.driver("bolt://localhost:7687")
session = driver.session()

Result:

TypeError Traceback (most recent call last)
in ()
----> 1 session = driver.session()

/Users/danielmanchon/Atlasense/tmp/venv/lib/python3.5/site-packages/neo4j/v1/bolt.py in session(self, access_mode)
49 def session(self, access_mode=None):
50 try:
---> 51 return BoltSession(self.pool.acquire(self.address))
52 except ServiceUnavailable as error:
53 if error.code == "Neo.ClientError.Security.Unauthorized":

/Users/danielmanchon/Atlasense/tmp/venv/lib/python3.5/site-packages/neo4j/bolt/connection.py in acquire(self, address)
457 connection.in_use = True
458 return connection
--> 459 connection = self.connector(address)
460 connection.pool = self
461 connection.in_use = True

/Users/danielmanchon/Atlasense/tmp/venv/lib/python3.5/site-packages/neo4j/v1/bolt.py in (a)
44 self.security_plan = security_plan = SecurityPlan.build(**config)
45 self.encrypted = security_plan.encrypted
---> 46 pool = ConnectionPool(lambda a: connect(a, security_plan.ssl_context, **config))
47 Driver.init(self, pool)
48

/Users/danielmanchon/Atlasense/tmp/venv/lib/python3.5/site-packages/neo4j/bolt/connection.py in connect(address, ssl_context, **config)
613 s.close()
614 elif agreed_version == 1:
--> 615 return Connection(s, der_encoded_server_certificate=der_encoded_server_certificate, **config)
616 elif agreed_version == 0x48545450:
617 log_error("S: [CLOSE]")

/Users/danielmanchon/Atlasense/tmp/venv/lib/python3.5/site-packages/neo4j/bolt/connection.py in init(self, sock, **config)
254 def init(self, sock, **config):
255 self.socket = sock
--> 256 self.buffering_socket = BufferingSocket(self)
257 self.channel = ChunkChannel(sock)
258 self.packer = Packer(self.channel)

/Users/danielmanchon/Atlasense/tmp/venv/lib/python3.5/site-packages/neo4j/bolt/connection.py in init(self, connection)
97 self.connection = connection
98 self.socket = connection.socket
---> 99 self.address = Address(*self.socket.getpeername())
100 self.buffer = bytearray()
101

TypeError: new() takes 3 positional arguments but 5 were given

In my enviroment the call to self.socket.getpeername() is returning a tuple with 4 members, not the 2 expected by the namedtuple Address

Using version 1.1.0b1 without issues.

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions