Search code examples
python-3.xneo4jpy2neo

py2neo: ImportError: cannot import name 'Rev'


I have 4.2 version of py2neo [ py2neo in c:\programdata\anaconda3\lib\site-packages (4.2.0) ]

and when importing in my python script, seeing this error

from py2neo import Graph, Node, Path, Rev
ImportError: cannot import name 'Rev'

also when using Path

path_1 = Path(bradley,"Knows",matthew, "Knows", lisa)
graph.create(path_1)
path_3 = path_1.append("Knows",path_2)
AttributeError: 'Path' object has no attribute 'append'

What am I doing wrong?


Solution

  • You're using old code in a new version of py2neo. The Rev class was removed a while ago (you just need a regular Relationship now) and you can concatenate paths now with the addition operator: https://py2neo.org/v4/data.html#path-objects-and-other-walkable-types