[Python] Python - the SQLite database file was loaded in a wrong encoding 'UTF-8'

Discussão em 'Python' iniciado por Stack, Dezembro 9, 2024.

  1. Stack

    Stack Membro Participativo

    I wrote a query to create a SQLite database and the query is completely correct. The database file is created in my project files but when I try to open it (in pycharm), this message shows up:


    The file was loaded in a wrong encoding 'UTF-8'
    ​

    This is the code causing this problem :

    import sqlite3
    connection = sqlite3.connect("./one_database.db")
    cursor = connection.cursor()
    sql = """
    CREATE TABLE IF NOT EXISTS User (
    user_NAME VARCHAR (60),
    user_CHATID FLOAT (20),
    user_PHONENUMBER VARCHAR )
    """
    cursor.execute(sql)
    connection.commit()
    connection.close()


    So far, I tried to download and update all drivers and needs for SQLite3 and everything is up to date. I've tried all solutions I found on Google (including JetBrains official documentation, Stack Overflow, etc.) but none of the above is working and the result is the same!

    I'm using: Python 3.8 | PyCharm 2021.1

    Continue reading...

Compartilhe esta Página