py2neo NameError: name 'open' is not defined

冯敏达
2023-12-01

今天在使用py2neo的时候出现了下面的错误:

GraphDataUpdate.py:122: DeprecationWarning: time.clock has been deprecated in Python 3.3 and will be removed from Python 3.8: use time.perf_counter or time.process_time instead
  elapsed = (time.clock() - start)
Time used: 1.196386
Exception ignored in: <function Connection.__del__ at 0x11528df28>
Traceback (most recent call last):
  File "/Users/admin/anaconda3/lib/python3.7/site-packages/py2neo/packages/neo4j/v1/bolt.py", line 244, in __del__
  File "/Users/admin/anaconda3/lib/python3.7/site-packages/py2neo/packages/neo4j/v1/bolt.py", line 358, in close
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 1383, in info
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 1519, in _log
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 1529, in handle
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 1591, in callHandlers
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 905, in handle
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 1131, in emit
  File "/Users/admin/anaconda3/lib/python3.7/logging/__init__.py", line 1121, in _open
NameError: name 'open' is not defined

我的neo4j的数据库连接代码为:

graph = Graph(bolt=True,host=host,user=username,password=password)

解决方法

graph = Graph(secure=False, bolt=False,host=host,user=username,password=password)

把secure和bolt都置为false就行了哈。

参考文献

[1].py2neo bolt ProtocolError: Server closed connection. https://stackoverflow.com/questions/43131325/py2neo-bolt-protocolerror-server-closed-connection

 类似资料:

相关阅读

相关文章

相关问答