'URI scheme b'' is not supported', but using the text file with instance details from NeoJ with load_dev()

Hey all,

I am trying to access the instance that I have created using the Neo4J website. I have created a graph using the website and am trying to access it using Python and the instances URI. When I try to access the instance using the Python code below, it gives me the following error:

from neo4j import GraphDatabase

# Manage the API keys
load_status = load_dotenv("Neo4j-a0a2fa1d-Created-2023-11-06.txt")
URI = os.getenv("NEO4J_URI")
AUTH = (os.getenv("NEO4J_USERNAME"), os.getenv("NEO4J_PASSWORD"))

with GraphDatabase.driver(URI, auth=AUTH) as driver:
    driver.verify_connectivity()
    print("Connection established.")
ConfigurationError: URI scheme b'' is not supported. Supported URI schemes are ['bolt', 'bolt+ssc', 'bolt+s', 'neo4j', 'neo4j+ssc', 'neo4j+s']. Examples: bolt://host[:port] or neo4j://host[:port][?routing_context]

The text file is like this, with only the important details hidden:

NEO4J_URI=neo4j+s://abcd.databases.neo4j.io
NEO4J_USERNAME=neo4j
NEO4J_PASSWORD=****
AURA_INSTANCEID=abcd
AURA_INSTANCENAME=Instance01

I want to highlight that the scheme is one of the approved schemes, so I am unsure why I am getting this error. Can someone please enlighten me?

I am using neo4J version 5.23.0

To start ,I'd be interested to inspect the value of URI to see what your code is getting

just before the line starting 'with' put print(f"URI value: {URI}") and see what is displayed when the code is executed.

1 Like

The value was "None", so I double checked the directory path. I was referencing the right file, but the right directory was two parent directories up :man_facepalming:
So now it works!