0

I am new to neo4j and trying to execute the demo project(Movie search) provided in neo4j website. While doing so I am getting an error to instantiate neo4j server from python. Alternatively, I am able to up and run neo4j server externally and use it. Please find the python code snippet and error details -

import os
from json import dumps
from flask import Flask, g, Response, request
from neo4j.v1 import GraphDatabase, basic_auth
app = Flask(__name__, static_url_path='/static/')
password = os.getenv("NEO4J_PASSWORD")
driver = GraphDatabase.driver('bolt://localhost',auth=basic_auth("neo4j", password))
.
.

when I run this above mention code I get the following error message:

Traceback (most recent call last):
File "movies.py", line 12, in <module>
driver = GraphDatabase.driver('bolt://localhost',auth=basic_auth("neo4j", password))
File "C:\Users\611593250\AppData\Local\Programs\Python\Python36-32\lib\site-packages\neo4j\v1\api.py", line 124, in driver
return driver_class(uri, **config)
File "C:\Users\611593250\AppData\Local\Programs\Python\Python36-32\lib\site-packages\neo4j\v1\direct.py", line 65, in __init__
pool.release(pool.acquire())
File "C:\Users\611593250\AppData\Local\Programs\Python\Python36-32\lib\site-packages\neo4j\v1\direct.py", line 44, in acquire
raise ServiceUnavailable("Cannot acquire connection to {!r}".format(self.address))
neo4j.exceptions.ServiceUnavailable: Cannot acquire connection to Address(host='localhost', port=7687)

Please advice. Thanks in advance!

Kaustav Roy
  • 49
  • 1
  • 5

1 Answers1

1

You have to add your bolt port when defining the bolt url like below:

import os
from json import dumps
from flask import Flask, g, Response, request
from neo4j.v1 import GraphDatabase, basic_auth
app = Flask(__name__, static_url_path='/static/')
password = os.getenv("NEO4J_PASSWORD")
driver = GraphDatabase.driver('bolt://localhost:7687',auth=basic_auth("neo4j", password))
print driver

hope this helps!

techie95
  • 515
  • 3
  • 16