troubleshooting Question

read a list of images into sqlite 'wb'

Avatar of Dolamite Jenkins
Dolamite JenkinsFlag for United States of America asked on
* python3* sqlite3Python
3 Comments1 Solution14 ViewsLast Modified:
import sqlite3
conn=sqlite3.connect('facial.db')
cursor = conn.cursor()

#=========================Insert Photos =======================
# Convert digital data to binary format
def convertToBinaryData(images):
    for images in Directory:
        with open(images, 'wb') as f:
            photo = f.read()
        name= "Pix"+1
       

    cursor.execute("""INSERT INTO faces_file (name, photo) VALUES (?,?) """,(name,photo)
convertToBinaryData(images)
conn.commit()
cursor.close()
conn.close()
photos are in the below directory and I want to read the list into my data base

Directory/
photo1.jpg
photo2.jpg
photo3.jpg

1. trying to read this list of Binary images into data base.... I can do it one at a time which is to slow

2. need to photos from Directory into a list to be encoded (Opencv) 
ASKER CERTIFIED SOLUTION
David Favor
Fractional CTO
Join our community to see this answer!
Unlock 1 Answer and 3 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 3 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros