Graph through terminal

A toy example here trying to see if command line access to database graph works:
Opened the neo4j browser for the default database Movie from the neo4j Desktop.

In the Terminal, entered:

from py2neo import Graph
graph = Graph("bolt://localhost:7687")

Error appears:
py2neo.errors.ConnectionUnavailable: Connection has been closed

Any idea why the error?

You have to check if the service is indeed running on 7687 of your local machine. If you run multiple instances of Neo4j db in Neo4j browser they are going to listen on different ports. If you run linux, I could also check your firewall settings (ufw).

You may also have to make a change to the default listen address in the neo4j.conf. Here's the relevant section with the relevant instructions:

# With default configuration Neo4j only accepts local connections.
# To accept non-local connections, uncomment this line:

Here is the message on the neo4j browser directly opened from the desktop. And I'm using a mac os.

The bolt connection can be found from the ... - log next to the database name on the neo4j Desktop. It's for the Movie DBMS.

Then the terminal access is ok. Thanks for the above replies.