Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
08-11-2022 05:58 AM
Hi,
I'm getting the following error when trying to run a python script that is connected to my graph:
Traceback (most recent call last):
File "/Users/Python scripts/python/cdpipe.py", line 46, in <module>
result = session.run(query)
NameError: name 'session' is not defined
Here is my code snippet where the error occurs:
query = "MATCH (d:Document) WHERE size((a)-[:HAS_WORD]->(:Word)) = 0 RETURN a.company as company, a.doctype as doctype, a.text as text"
result = session.run(query)
baselist = []
for record in result:
baselist.append(record);
for rec in baselist:
company = rec["company"]
ndocument = rec["doctype"]
ntext = rec["text"]
print("processing company %s doctype %s" % (company, ndoctype))
parameters = { "companyv": company, "wordsv": getWords(ndoctype, stopwords, ps) };
Anyone know why this happens? I ran a very similar script a few minutes ago and it worked - but I'm stumped on this.
Any help very much appreciated
08-11-2022 11:36 AM
Share your full script. You're probably not creating the session in the right place.
08-11-2022 12:59 PM
Hi @michael_hunger - thank you - I actually realised the error - and it was, as you mentioned not creating the session correctly. Case closed !
All the sessions of the conference are now available online