【问题标题】:NEO4J Underlying socket connection gone (_ssl.c:2084)NEO4J 底层套接字连接消失 (_ssl.c:2084)
【发布时间】:2019-11-12 09:58:32
【问题描述】:
  1. 我已经安装了neo4j-driver 1.7.5
  2. 我设置了Neo4J Causal Cluster
  3. 尝试在 Python 中开始编码以连接到它。 (我知道它的螺栓+路由,但现在使用默认代码)

代码

# REF https://pypi.org/project/neo4j-driver/
from neo4j import GraphDatabase

driver = GraphDatabase.driver("bolt://localhost:7687", auth=("neo4j", "password"))

def add_friend(tx, name, friend_name):
    tx.run("MERGE (a:Person {name: $name}) "
           "MERGE (a)-[:KNOWS]->(friend:Person {name: $friend_name})",
           name=name, friend_name=friend_name)

def print_friends(tx, name):
    for record in tx.run("MATCH (a:Person)-[:KNOWS]->(friend) WHERE a.name = $name "
                         "RETURN friend.name ORDER BY friend.name", name=name):
        print(record["friend.name"])

with driver.session() as session:
    session.write_transaction(add_friend, "Arthur", "Guinevere")
    session.write_transaction(add_friend, "Arthur", "Lancelot")
    session.write_transaction(add_friend, "Arthur", "Merlin")
    session.read_transaction(print_friends, "Arthur")

输出

Guinevere
Lancelot
Merlin
Failed to write data to connection Address(host='localhost', port=7687) (Address(host='127.0.0.1', port=7687)); ("0; 'Underlying socket connection gone (_ssl.c:2084)'")
Failed to write data to connection Address(host='localhost', port=7687) (Address(host='127.0.0.1', port=7687)); ("0; 'Underlying socket connection gone (_ssl.c:2084)'")

如果我在最后添加这个

driver.close()

那么我没有得到套接字消失的错误。

【问题讨论】:

标签: python neo4j cypher


【解决方案1】:

我已经通过以下命令解决了这个问题

pip install --force-reinstall neo4j==1.7.2 neobolt==1.7.9 neotime==1.7.4

https://github.com/neo4j/neo4j-python-driver/issues/293

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2011-04-14
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 2019-06-10
    • 2010-09-12
    • 2022-01-10
    相关资源
    最近更新 更多