Hi everyone, I am running a code found in this book Hands-On Graph Analytics with Neo4j which originally had a missing parentheses (alredy fixed), but still has something wrong
from neo4j import GraphDatabase
URL="bolt://localhost:7687"
USER="neo4j"
PWD="neo4j"
driver = GraphDatabase.driver(URL, auth= (USER, PWD))
query = "MATCH (a:Person {id: 2037491})- [:IS_FRIEND_WITH]-(b:Person) RETURN count(b.id)"
with driver.session() as session:
with session.begin_transaction() as tx:
result = tx.run(query)
summary = result.summary()
avail = summary.result_available_after # ms
cons = summary.result_consumed_after # ms
total_time = avail + cons
Hi Steve thank you for your help, I did the modification but now I have another error
ServiceUnavailable: Failed to establish connection to ('127.0.0.1', 7687)
(reason [WinError 10061] Unable to establish a connection as the target
computer expressly denied that connection)
Unfortunately, I can't help much with this one. I've only seen this message on our server at work. It requires administrator privileges to open the port, which I do not have. If you have sufficient privileges, you might try looking at the link below (I assume you are running Windows, since the message references WinError.)
Hopefully, someone with more experience with this error will post more.
Glad you got it working. This new one looks like a Python error. It looks like your query probably is not returning any results since it's saying avail and cons are both None.