// Change the text output format from unicode to UTF-8
args.connect.text_factory = str
// Database handler
args.sq = args.connect.cursor()
// Run and image IDs
args.run_id = 0
args.image_id = 0
After Change
for row in args.sq.execute("SELECT name FROM sqlite_master WHERE type="table""):
if row["name"] == "runinfo":
runinfo = True
elif row["name"] == "metadata":
metadata = True
if runinfo is True and metadata is True:
for row in args.sq.execute("SELECT MAX(run_id) AS max FROM runinfo"):
if row["max"] is not None: