simonw / sqlite-utils

Python CLI utility and library for manipulating SQLite databases
https://sqlite-utils.datasette.io
Apache License 2.0
1.58k stars 106 forks source link

Pyhton 3.12 Bug report #603

Open constantinedev opened 8 months ago

constantinedev commented 8 months ago

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.

simonw commented 7 months ago

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)]'
tobych commented 2 months ago

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.