Unable to connect Neo4j

Hi Team,

I am currently facing an issue to connecting neo4j. Despite multiple attempts, I have been unable to establish a connection. I have verified the network settings and followed the standard troubleshooting steps, but the problem still persists.

could you please assist me in resolving this issue.

I have attached My problem code:-
%%time

intermediate_path= 'r/project/shubhika/inputfile'
db_name= 'test_db'

def neo4j_file_upload(intermediate_path,db_name):

#start men memory_usage()
print("Before code execution:")
memory usage()

neo4j_files_location=f""" (intermediate_path)"""
default_database f{db_name}***

#creates graph database on neo4j. If database already exists with the same name, it deletes previously created dataframe.

try:

subprocess.run(['rm', '-r', f'/home/neo4j-community-4.2.0/data/databases/(db_name)"], check-True)

subprocess.run(['rm', 'r', f'/home/neo4j-community-4.2.0/data/transactions/{db_name)"], check-True)

print("existing De has been deleted")

except:

print("De already deleted")

rel_files-glob.glob(os.path.join(neo4j_files_location, r**rel*.csv"))

all_files-glob.glob(os.path.join(neo4j_files_location,r"*.csv"))

node_files [i for i in all files if i not in rel files]

init-f""./neo4j-admin import-database (default_database)"""

node_string.join([--nodesi for i in node_files])

skip_dups-skip-duplicate-nodes"

rel_string'.join([-relationships+i for i in rel files])

bulk_upload_cmd.join([init, node string, skip_dups,rel_string])

#upload of database to neo4j
print(subprocess.run(bulk_upload_cmd, cwd = '/home/neo4j-community-4.2.0/bin', stdout subprocess.PIPE, shell True).stdout)
fopen(/home/neo4j-community-4.2.e/conf/neo4j.conf, 'r')
fread f.readlines()
fread [12] fdbms.default_database (default_database)\n"
filel open(/home/neo4j-community-4.2.e/conf/neo4j.conf', 'w')
filel.writelines (fread)
filel.close()
print("neo4j restart")

subprocess.run(['bash', 'neo4j', 'restart'], cwd /home/neo4j-community-4.2.8/bin", stdout-subprocess.PIPE).stdout

for i in range(0, 3):

graph-Graph("bolt://10.127.56,22:5575", auth-('enter username', 'enter password"))

try
print('connected')
except:
print("connection failed: Sleeping for 60 secs before next try:".format(1))
time.sleep(60)
continue

break
return graph

#calling function here..
graph neo41 file_upload(intermediate_path,db_name)

Error:-

Thanks & Regards
Shubhika Tiwari

Looking at the error, it is a logical error in your code where you try to use the variable "graph" before you assign that variable a value