Answer the question
In order to leave comments, you need to log in
How to remember image in sql lite?
I need to remember in sql lite table image here is my code but error
import sqlite3
con = sqlite3.connect('test.db')
cur = con.cursor()
# Получаем бинарные данные нашего файла
data = open("C:/new_project/images/test.jpg")
# Конвертируем данные
binary = sqlite3.Binary(data) ошибка вот тут и она вот такая (TypeError: memoryview: a bytes-like object is required, not '_io.TextIOWrapper')
# Готовим запрос в базу
cur.execute("INSERT INTO Images(Data) VALUES (?)", (binary,))
# Выполняем запрос
con.commit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question