Dzianis
Dzianis

Reputation: 1

Neomodel + Aura DB -> Exception ignored in: <function Bolt.__del__ at 0x7f1fe64679a0>

I'm getting exception in console during running the next code:

ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function Bolt.__del__ at 0x7f1fe64679a0>

I'm using Python 3.10, neomodel and Neo4j Aura

Вespite, data is saved in DB.

What I'm doing wrong?

from neomodel import (config, StructuredNode, StringProperty, IntegerProperty,
                      UniqueIdProperty)

user = 'neo4j'
psw = 'test'
uri = 'test.databases.neo4j.io'

config.DATABASE_URL = 'neo4j+s://{}:{}@{}'.format(user, psw, uri)


class Person(StructuredNode):
    uid = UniqueIdProperty()
    name = StringProperty(unique_index=True)
    age = IntegerProperty(index=True, default=0)
    
if __name__ == "__main__":
    jim = Person(name='Jisdm', age=3).save()  # Create
    jim.name = "adasd"
    jim.save()  # Update, (with validation)

The error

Exception ignored in: <function Driver.__del__ at 0x7f1fe649e440>
Traceback (most recent call last):
  File ".local/lib/python3.10/site-packages/neo4j/_sync/driver.py", line 411, in __del__
  File ".local/lib/python3.10/site-packages/neo4j/_sync/driver.py", line 456, in close
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_pool.py", line 367, in close
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_pool.py", line 320, in _close_connections
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 757, in close
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 609, in _send_all
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_common.py", line 145, in flush
  File ".local/lib/python3.10/site-packages/neo4j/_async_compat/util.py", line 113, in callback
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 688, in _set_defunct_write
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 691, in _set_defunct
ImportError: sys.meta_path is None, Python is likely shutting down
Exception ignored in: <function Bolt.__del__ at 0x7f1fe64679a0>
Traceback (most recent call last):
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 161, in __del__
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 757, in close
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 609, in _send_all
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_common.py", line 145, in flush
  File ".local/lib/python3.10/site-packages/neo4j/_async_compat/util.py", line 113, in callback
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 688, in _set_defunct_write
  File ".local/lib/python3.10/site-packages/neo4j/_sync/io/_bolt.py", line 691, in _set_defunct
ImportError: sys.meta_path is None, Python is likely shutting down

Process finished with exit code 0


Upvotes: 0

Views: 219

Answers (1)

NavinDev
NavinDev

Reputation: 995

I had the same issue when using Neo4jGraph via Langchain. The script seems to finish before the database driver completes its cleanup. Fixed it by calling close() explicitly at the end of

if __name__ == "__main__":

uri = "neo4j://example.com:7687"
driver = GraphDatabase.driver(uri, auth=("neo4j", "password"))

driver.close()  # close the driver object.

for langchain it was

neo_graph._driver.close() 

Upvotes: 0

Related Questions