mysql - Python - MySQLdb: ValueError - unsupported format - although the use of the execute substitution -
i'm trying update blob images in database python-mysqldb package error:
valueerror: unsupported format character ',' (0x2c) @ index 64
i've added images time ago execute substitution tools example this:
set connection db:
db = mysqldb.connect( host="127.0.0.1", port=0815, user="javert", passwd="ureyes", db="some_db") cur = db.cursor()
read image files:
images = [ open( image_file, 'rb') image_file in folder ] image1, ..., image6 = images
insert images:
command = """insert database_table (column1, ..., column6) values (%s,%s,%s,%s,%s,%s)""" cur.execute( command, args=( image1, ..., image6)) db.commit()
now i've replaced insert command following , described error:
"""update database_table set column1=%s, column2=%s, column3=%s, column4=s%, column5=%s, column6=%s id=table_row_id"""
thank help!
column4=s%,
should column4=%s,
(note inverted ,
, s
).
observe error message says (,
isn't appropriate "format character"): "format character" comes after %
, , ,
not valid one.
Comments
Post a Comment