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

fix: rename sqlite3.py to sqlite3_utils.py and correct imports - avoi… #25

Merged
merged 2 commits into from
Apr 10, 2024

Conversation

Abdur-rahmaanJ
Copy link
Contributor

…d runtime errors

@penberg
Copy link
Contributor

penberg commented Apr 10, 2024

@Abdur-rahmaanJ What is the error you are seeing?

@Abdur-rahmaanJ
Copy link
Contributor Author

Abdur-rahmaanJ commented Apr 10, 2024

Sorry, filling up

Problem

I began experiencing sqlite errors on 3 python hosts,

  1. Render.com
    dbapi = dbapi_meth(**dbapi_args)
            ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/sqlalchemy_libsql/__init__.py", line 92, in import_dbapi
    from libsql_client import dbapi2 as libsql_client
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/libsql_client/dbapi2/__init__.py", line 16, in <module>
    from ._reexports import *  # noqa: F401,F403
    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/render/project/src/.venv/lib/python3.11/site-packages/libsql_client/dbapi2/_reexports.py", line 76, in <module>
    from sqlite3.dbapi2 import (
ImportError: cannot import name 'SQLITE_BUSY_TIMEOUT' from 'sqlite3.dbapi2' (/usr/local/lib/python3.11/sqlite3/dbapi2.py)
  1. koyeb.com, Python3.12

Selection_330

  1. pythonanywhere.com, Python3.10

Selection_331

The app runs fine on my PC, mint 20 with Python3.11, and Python3.12 though. It just gives errors on deploys.

Solution background

While searching for an answer i saw this SO post about AttributeNotFound for SQLite, with the issue being a file named sqlite3.py present in the target project.

Iit's never a good idea, irrespective of my issue to name a file the same as a module or package, happens often when people name their first Flask app, flask.py.

The project i was trying to deploy is this one: https://github.com/linkversity/linkversity

I contacted Render's support, they are as clueless as me.

So, @penberg hope it helps!

How this PR helps

It renames sqlite3.py to sqlite3_utils and renames imports accordingly.

@penberg penberg merged commit 595964c into tursodatabase:main Apr 10, 2024
2 checks passed
@Abdur-rahmaanJ
Copy link
Contributor Author

@penberg You have an idea when this fix will be deployed?

@Abdur-rahmaanJ Abdur-rahmaanJ deleted the fix/sqlite3-errors branch April 10, 2024 10:15
@penberg
Copy link
Contributor

penberg commented May 3, 2024

@Abdur-rahmaanJ I just released 0.3.1 with this fix.

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

Successfully merging this pull request may close these issues.

2 participants