Search code examples
neo4jcyphernodespy2neo

py2neo graph.node(ID) throws "Unsupported URI scheme"


I am iterating over this record returned by cypher.execute():

   | p                         
---+----------------------------
 1 | (:A)-[:r]->(:B)-[:r]->(:C)

The code I use to iterate over it is this:

recordList = graph.cypher.execute(<some query>)
for record in recordList:
    for rel in record[0]:
        print self.graph.node(rel.start_node)

But I get the following error:

  File "/usr/local/lib/python2.7/dist-packages/py2neo/packages/httpstream/http.py", line 943, in __get_or_head
    return rq.submit(redirect_limit=redirect_limit, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/py2neo/packages/httpstream/http.py", line 433, in submit
    http, rs = submit(self.method, uri, self.body, self.headers)
  File "/usr/local/lib/python2.7/dist-packages/py2neo/packages/httpstream/http.py", line 302, in submit
    raise ValueError("Unsupported URI scheme " + repr(uri.scheme))
ValueError: Unsupported URI scheme 'node/(n4979'

What am i doing wrong here?


Solution

  • Why not just

    print(rel.start_node)
    

    Your code takes a node and then uses that node to select exactly the same node from the graph. Which is clearly redundant.