sqlite-utils icon indicating copy to clipboard operation
sqlite-utils copied to clipboard

Pyhton 3.12 Bug report

Open constantinedev opened this issue 2 years ago • 3 comments

I start with new python3 verison 3.12.0 Also have the error where connect DataBase

Traceback (most recent call last):
  File "/home/t/Development/python/FKPJ/ClinicSYS/run.py", line 1, in <module>
    import re, os, io, json, sqlite_utils, requests, pytz, logging
  File "/home/t/.local/lib/python3.12/site-packages/sqlite_utils/__init__.py", line 1, in <module>
    from .db import Database
  File "/home/t/.local/lib/python3.12/site-packages/sqlite_utils/db.py", line 277, in <module>
    class Database:
  File "/home/t/.local/lib/python3.12/site-packages/sqlite_utils/db.py", line 306, in Database
    filename_or_conn: Optional[Union[str, pathlib.Path, sqlite3.Connection]] = None,
                                                        ^^^^^^^^^^^^^^^^^^

This bug come from sqlite-utils since's v3.33. Anyone get the same ?

As well now of the resolved plan just keep the sqlite-utils version in python3.12 with v3.32.1 [tested] but where are the sqlite3.Connection problem....

This won't happen on python version down to 3.11[tested] Just the python3.12.0, I have test this error are come from the sqlite3 connection The error say from sqlite_utils and with the sqlite3 Connection, what can I do.

Let fix together.

constantinedev avatar Nov 10 '23 22:11 constantinedev

I'm unable to replicate this issue. This is with a fresh install of sqlite-utils==3.35.2:

(base) ~ python3.12
Python 3.12.0 (v3.12.0:0fb18b02c8, Oct  2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import sqlite_utils
>>> db = sqlite_utils.Database(memory=True)
>>> db["foo"].insert({"bar": 1})
<Table foo (bar)>
>>> import sys
>>> sys.version
'3.12.0 (v3.12.0:0fb18b02c8, Oct  2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)]'

simonw avatar Dec 08 '23 05:12 simonw

I, too, am unable to replicate this issue. I've tried doing what Simon did above, and opening a local file on my machine. I used a fresh install of sqlite-utils==3.33 and Python 3.12.0 (on macOS Sonoma 14.1.1, Intel).

I suggest closing this as unable to replicate. Not sure how that works on GitHub though.

tobych avatar Apr 29 '24 02:04 tobych

I'm also unable to replicate this issue. I'm using sqlite-utils 3.37 and Python 3.12.5 on Windows 10

I copied Simon's commands from his reply and also tested with saving database to disk. Everything works as expected. Results below.

Python 3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.

import sqlite_utils
db = sqlite_utils.Database(memory=True)
db["foo"].insert({"bar": 1})
<Table foo (bar)>
db["foo"].get(1)
{'bar': 1}
db2 = sqlite_utils.Database("bar.db")
db2["bar"].insert({"bar": 1})
<Table bar (bar)>
db2["bar"].insert({"bar": 2})
<Table bar (bar)>
db2["bar"].get(2)
{'bar': 2}
import sys
sys.version
3.12.5 (tags/v3.12.5:ff3bc82, Aug  6 2024, 20:45:27) [MSC v.1940 64 bit (AMD64)]

Should this issue be closed if no one is able to replicate the bug?

JukkaSartinen avatar Aug 14 '24 18:08 JukkaSartinen