You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
When calling any autoimport API that uses Autoimport.connection.execute() from a thread different than the one from which the sqlite db was created, we get an error
sqlite3.ProgrammingError: SQLite objects created in a thread can only be used in that same thread. The object was created in thread id <x> and this is thread id <y>.
To Reproduce
Steps to reproduce the behavior:
Setup
fromrope.base.projectimportProjectfromrope.contrib.autoimport.sqliteimportAutoImportproject=Project('.')
autoimport=AutoImport(project, memory=False)
autoimport.generate_cache() # Generates a cache of the local modules, from the project you're working onautoimport.generate_modules_cache() # Generates a cache of external modulesdefsearch_and_print(search_string):
print(list(autoimport.search_full(search_string)))
I created a PR also to facilitate discussion. I am aware that my proposal makes the sqlite db not threadsafe. python-lsp-server is the user of this feature. Happy to discuss how python-lsp-server can work around that. I have a current workaround in place python-lsp/python-lsp-server#471
Describe the bug
When calling any autoimport API that uses
Autoimport.connection.execute()
from a thread different than the one from which the sqlite db was created, we get an errorTo Reproduce
Steps to reproduce the behavior:
Why is this relevant?
rope is used by
python-lsp-server
, which usesthreading
Additional context
The fix is easy. I'll open up a PR
The text was updated successfully, but these errors were encountered: