neo4j / neo4j-python-driver

Neo4j Bolt driver for Python
https://neo4j.com/docs/api/python-driver/current/
Other
883 stars 187 forks source link

Exception ignored in: <function Driver.__del__ at 0x7ff101714d30> #1024

Closed mfreeman451 closed 5 months ago

mfreeman451 commented 5 months ago

Bug Report

Trying to perform a vector search in neo4j python SDK 5.17.0 and along with some results being returned, I get an exception that I can't catch.

Code: https://paste.lol/mfreeman451/neo4j-error

Error:

% time python3 llm_querier.py
here is bob
yeah, bob
i would tend to agree, bob
sup bob
Exception ignored in: <function Driver.__del__ at 0x7ff101714d30>
Traceback (most recent call last):
  File "/home/mfreeman/venv/lib/python3.10/site-packages/neo4j/_sync/driver.py", line 489, in __del__
  File "/home/mfreeman/venv/lib/python3.10/site-packages/neo4j/_meta.py", line 229, in unclosed_resource_warn
TypeError: 'NoneType' object is not callable
python3 llm_querier.py  5.24s user 2.24s system 147% cpu 5.086 total

My Environment

Python Version: Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0] Driver Version: Version: 5.17.0 Server Version and Edition: Neo4J 5.17 - Enterprise Operating System: Ubuntu 22.04

mfreeman451 commented 5 months ago

fixed with threadr_chat_vector._driver.close() -- didn't see that in any documentations or examples..

robsdedude commented 5 months ago

Hello and thanks for reaching out. Great to hear you managed to figure out that you need to close the driver.

It is actually documented: https://neo4j.com/docs/api/python-driver/current/api.html#neo4j.GraphDatabase The first 2 examples of using the driver in the API docs show how to either close it using a call to .close(), or better yet, how to use the driver as a context manager using the with keyword.

mfreeman451 commented 5 months ago

I'm following along with lessons in the neo4j academy and I don't think it was mentioned how to do it through the langchain wrapper.

On Thu, Feb 29, 2024 at 3:16 AM Robsdedude @.***> wrote:

Hello and thanks for reaching out. Great to hear you managed to figure out that you need to close the driver.

It is actually documented: https://neo4j.com/docs/api/python-driver/current/api.html#neo4j.GraphDatabase The first 2 examples of using the driver in the API docs show how to either close it using a call to .close(), or better yet, how to use the driver as a context manager using the with keyword.

— Reply to this email directly, view it on GitHub https://github.com/neo4j/neo4j-python-driver/issues/1024#issuecomment-1970720255, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAN4Z2SG2JUL32BRXIQXIETYV3YXTAVCNFSM6AAAAABD66KCJWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNZQG4ZDAMRVGU . You are receiving this because you modified the open/close state.Message ID: @.***>

adam-cowley commented 5 months ago

Hey @mfreeman451 , which graphacademy lesson did you run into this problem on? I will get it updated ASAP

mfreeman451 commented 5 months ago

Hey @mfreeman451 , which graphacademy lesson did you run into this problem on? I will get it updated ASAP

https://graphacademy.neo4j.com/courses/llm-fundamentals/