This is my py2neo
code for creating a graph from a txt file:
import csv
import re
from py2neo import Graph,Node,Relationship
graph = Graph("http://localhost:7474/browser/")
with open("<>") as infile:
row_num = 0
for row in infile:
row1 = re.split(r'\s{2,}', row[6:13])
row2 = re.split(r'\s{2,}', row[16:76])
#print len(row2[0]),row2[0]
if(row_num<1000):
x = len(row1[0])
code = Node("Dis_code", Code=row1[0])
valid = Node("Valid", Valid=row[14])
name = Node("Name_dis", Name=row2[0])
code_is_valid = Relationship(code,"valid or not",valid)
code_name= Relationship(code, "has name", name)
#x=len(row1[0])
print x
parent = []
if (x>3):
row_num = row_num + 1
print row1[0][:-1]
for cod in graph.run("MATCH (p:Dis_code{Code:row1[0][:-1]}) RETURN p"):
print cod
code_parent = Relationship(code,"has_parent",cod)
I get the following error:
Traceback (most recent call last):
File "C:/Users/<>/PycharmProjects/graph/data_model", line 24, in <module>
for cod in graph.run("MATCH (p:Dis_code{Code:row1[0][:-1]}) RETURN p"):
File "C:\Python27\lib\site-packages\py2neo-4.0.0b2-py2.7.egg\py2neo\graph.py", line 654, in run
return self.begin(autocommit=True).run(statement, parameters, **kwparameters)
File "C:\Python27\lib\site-packages\py2neo-4.0.0b2-py2.7.egg\py2neo\graph.py", line 380, in begin
return Transaction(self, autocommit)
File "C:\Python27\lib\site-packages\py2neo-4.0.0b2-py2.7.egg\py2neo\graph.py", line 804, in __init__
self.session = driver.session()
File "build\bdist.win32\egg\neo4j\v1\bolt.py", line 54, in session
neo4j.v1.security.Unauthorized: Unsupported authentication token, missing key `scheme`
I didn't find anything called scheme
in the run
module's documentation. So, where did I go wrong here?