I'm trying to execute a cypher query with py2neo 2.0 (and Neo4j 2.1.6), but it fails with the following error:
File "C:\Envs\project\lib\site-packages\py2neo\core.py", line 678, in cypher
self.__cypher = CypherResource(metadata["cypher"], metadata.get("transaction")) KeyError: "u'cypher'
While debugging, I found that the metadata property doesn't have a cypher
entry, but I'm wondering how I can solve it.
This error can be reproduced when initializing py2neo.Graph
with an invalid URI:
>>> from py2neo import Graph
>>> graph = Graph('http://localhost:7474')
>>> test = graph.cypher.execute('MATCH n RETURN n LIMIT 5')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/nicole/Envs/squid/lib/python2.7/site-packages/py2neo/core.py", line 678, in cypher
self.__cypher = CypherResource(metadata["cypher"], metadata.get("transaction"))
KeyError: u'cypher'
Perhaps Nigel can confirm, but in my experience with py2neo 2.0 you need to initialize with the /db/data/
endpoint:
>>> from py2neo import Graph
>>> graph = Graph('http://localhost:7474/db/data/')
>>> test = graph.cypher.execute('MATCH n RETURN n LIMIT 5')