Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot operate on a closed database #67

Open
mark-scherer opened this issue Oct 20, 2022 · 1 comment
Open

Cannot operate on a closed database #67

mark-scherer opened this issue Oct 20, 2022 · 1 comment

Comments

@mark-scherer
Copy link

Python garbage collection triggers error within SearchEngine.__del__:

Exception ignored in: <function SearchEngine.__del__ at 0x1050100d0>
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/uszipcode/search.py", line 196, in __del__
  File "/usr/local/lib/python3.9/site-packages/uszipcode/search.py", line 202, in close
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1811, in close
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 1853, in _close_impl
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/orm/session.py", line 923, in close
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2416, in close
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2639, in _do_close
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2625, in _close_impl
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2617, in _connection_rollback_impl
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1059, in _rollback_impl
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 2124, in _handle_dbapi_exception
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/util/compat.py", line 208, in raise_
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/base.py", line 1057, in _rollback_impl
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 683, in do_rollback
sqlalchemy.exc.ProgrammingError: (sqlite3.ProgrammingError) Cannot operate on a closed database.
(Background on this error at: https://sqlalche.me/e/14/f405)

Don't think this has to do with how I'm calling SearchEngine. Produces annoying error message when the script finishes.

@MacHu-GWU
Copy link
Owner

Could you show me some codesnippet? I believe you should close it when your query is done since it is a local database

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants