【发布时间】:2020-02-23 23:23:03
【问题描述】:
我的代码/手册的代码
从 py2neo 导入图,节点
图形 = 图形()
alice = Node("Person",name="Alice")
graph.create(爱丽丝)
错误是
Traceback(最近一次调用最后一次):文件 “/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 322 行,在提交中 响应=发送()文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 317 行,在发送中 http.request(xstr(method), xstr(uri.absolute_path_reference), body, headers) 文件 "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", 第 1229 行,应要求提供 self._send_request(method, url, body, headers, encode_chunked) 文件 "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", 第 1275 行,在 _send_request 中 self.endheaders(body, encode_chunked=encode_chunked) 文件“/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py”, 第 1224 行,在 endheaders 中 self._send_output(message_body, encode_chunked=encode_chunked) 文件 "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py", 第 1016 行,在 _send_output 中 self.send(msg)文件“/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/http/client.py”, 第 956 行,在发送中 self.connect() 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 80 行,在连接中 self.source_address)文件“/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socket.py”, 第 727 行,在 create_connection 中 引发错误文件“/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.7/lib/python3.7/socket.py”, 第 716 行,在 create_connection 中 sock.connect(sa) ConnectionRefusedError: [Errno 61] Connection denied
在处理上述异常的过程中,又发生了一个异常:
Traceback(最近一次调用最后一次):文件“ex.py”,第 4 行,在 graph.create(alice) 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/core.py”, 第 706 行,在创建中 声明 = CreateStatement(self) 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/cypher/create.py”, 第 44 行,在 init 中 self.supports_node_labels = self.graph.supports_node_labels 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/core.py”, 第 1080 行,在 supports_node_labels 返回 self.neo4j_version >= (2, 0) 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/core.py”, 第 958 行,在 neo4j_version 中 返回 version_tuple(self.resource.metadata["neo4j_version"]) 文件 “/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/core.py”, 第 213 行,在元数据中 self.get() 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/core.py”, 第 258 行,在获取 response = self.__base.get(headers=headers, redirect_limit=redirect_limit, **kwargs) 文件 “/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 966 行,在获取 return self.__get_or_head("GET", if_modified_since, headers, redirect_limit, **kwargs) 文件 “/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 943 行,在 __get_or_head 中 返回 rq.submit(redirect_limit=redirect_limit, **kwargs) 文件“/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 433 行,在提交中 http, rs = submit(self.method, uri, self.body, self.headers) 文件 “/Users/ben/Documents/CompSci/env/lib/python3.7/site-packages/py2neo/packages/httpstream/http.py”, 第 362 行,在提交中 raise SocketError(code, description, host_port=uri.host_port) py2neo.packages.httpstream.http.SocketError: Connection refused
【问题讨论】: