python - NEO4J 底层套接字连接消失 (_ssl.c:2084)
问题描述
- 我已经安装了neo4j-driver 1.7.5
- 我设置了Neo4J 因果集群
- 尝试在 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()
然后我没有得到套接字消失的错误。
解决方案
我已经通过以下命令解决了这个问题
pip install --force-reinstall neo4j==1.7.2 neobolt==1.7.9 neotime==1.7.4
推荐阅读
- python - 如何修复由 ujson.loads 引起的内存错误
- python - 如何仅删除一次在数组中重复的最小元素
- java - 没有方法签名: .android() 适用于参数类型。build.gradle(应用程序)中的异常
- firebase - Flutter:如何在使用 Firebase 时显示购物车中的商品数量
- shell - 我如何打印特定字段,并从每行包含分隔符的最后一个字段中获取最后一个单词
- r - 如何在R中的Excel中堆叠标签
- c++ - 构造函数和析构函数如何调用
- firebase - 使用 Firestore:如何防止恶意 ip 发送过多请求?
- c# - 由于 serviceProvider.GetService 无法添加单例服务
() 返回空值 - python-3.x - Tkinter 和 PIL 在 Python 中相互干扰(Image.open)