cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

Python error do_handshake_on_connect should not be specified for non-blocking sockets

I'm new to Neo4j and trying to connect python and neo4j database.
I've created Neo4j database with name = "test", password = "test" and then run it.
Then I started Jupyther notebook and run

!pip3 install neo4j

After succesful installation I run

from neo4j import GraphDatabase
graphdb = GraphDatabase.driver(uri = 'bolt://localhost:7687', auth = ('test', 'test'))

In learinig video and tutorials this step was succesful but I have error ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")

What I do wrong and how can I fix the problem?
Thank you in advance.

Full text of error:

---------------------------------------------------------------------------
FileNotFoundError                         Traceback (most recent call last)
<ipython-input-17-16953d2388cd> in <module>
----> 1 graphdb = GraphDatabase.driver(uri = 'bolt://localhost:7687', auth = ('test', 'test'))

~\Anaconda3\lib\site-packages\neo4j\__init__.py in driver(cls, uri, **config)
    118         :class:`.Driver` subclass instance directly.
    119         """
--> 120         return Driver(uri, **config)
    121 
    122 

~\Anaconda3\lib\site-packages\neo4j\__init__.py in __new__(cls, uri, **config)
    159         for subclass in Driver.__subclasses__():
    160             if parsed_scheme in subclass.uri_schemes:
--> 161                 return subclass(uri, **config)
    162         raise ValueError("URI scheme %r not supported" % parsed.scheme)
    163 

~\Anaconda3\lib\site-packages\neo4j\__init__.py in __new__(cls, uri, **config)
    233 
    234         pool = ConnectionPool(connector, instance.address, **config)
--> 235         pool.release(pool.acquire())
    236         instance._pool = pool
    237         instance._max_retry_time = config.get("max_retry_time", default_config["max_retry_time"])

~\Anaconda3\lib\site-packages\neobolt\direct.py in acquire(self, access_mode)
    713 
    714     def acquire(self, access_mode=None):
--> 715         return self.acquire_direct(self.address)
    716 
    717 

~\Anaconda3\lib\site-packages\neobolt\direct.py in acquire_direct(self, address)
    606                 if can_create_new_connection:
    607                     try:
--> 608                         connection = self.connector(address, error_handler=self.connection_error_handler)
    609                     except ServiceUnavailable:
    610                         self.remove(address)

~\Anaconda3\lib\site-packages\neo4j\__init__.py in connector(address, **kwargs)
    230 
    231         def connector(address, **kwargs):
--> 232             return connect(address, **dict(config, **kwargs))
    233 
    234         pool = ConnectionPool(connector, instance.address, **config)

~\Anaconda3\lib\site-packages\neobolt\direct.py in connect(address, **config)
    970         raise ServiceUnavailable("Failed to resolve addresses for %s" % address)
    971     else:
--> 972         raise last_error

~\Anaconda3\lib\site-packages\neobolt\direct.py in connect(address, **config)
    961             host = address[0]
    962             s = _connect(resolved_address, **config)
--> 963             s, der_encoded_server_certificate = _secure(s, host, security_plan.ssl_context, **config)
    964             connection = _handshake(s, address, der_encoded_server_certificate, **config)
    965         except Exception as error:

~\Anaconda3\lib\site-packages\neobolt\direct.py in _secure(s, host, ssl_context, **config)
    852         log_debug("[#%04X]  C: <SECURE> %s", local_port, host)
    853         try:
--> 854             s = ssl_context.wrap_socket(s, server_hostname=host if HAS_SNI and host else None)
    855         except SSLError as cause:
    856             s.close()

~\Anaconda3\lib\ssl.py in wrap_socket(self, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, session)
    421             server_hostname=server_hostname,
    422             context=self,
--> 423             session=session
    424         )
    425 

~\Anaconda3\lib\ssl.py in _create(cls, sock, server_side, do_handshake_on_connect, suppress_ragged_eofs, server_hostname, context, session)
    868                         # non-blocking
    869                         raise ValueError("do_handshake_on_connect should not be specified for non-blocking sockets")
--> 870                     self.do_handshake()
    871             except (OSError, ValueError):
    872                 self.close()

~\Anaconda3\lib\ssl.py in do_handshake(self, block)
   1137             if timeout == 0.0 and block:
   1138                 self.settimeout(None)
-> 1139             self._sslobj.do_handshake()
   1140         finally:
   1141             self.settimeout(timeout)

FileNotFoundError: [Errno 2] No such file or directory
2 REPLIES 2

ehume123
Node Clone

Hi, are you using Neo4j Browser or Sandbox to import your database?

Hello @ehume123 and welcome to the Neo4j community

I have several questions:

  • Which version of Neo4j are you using?
  • Did you create the database with Neo4j Desktop or did you install Neo4j as service?
  • Are you sure your login and password "test"?

Regards,
Cobra

Nodes 2022
Nodes
NODES 2022, Neo4j Online Education Summit

All the sessions of the conference are now available online