python - TypeError: can't escape psycopg2.extensions.Binary to binary -
i try store binary file postgresql through sqlalchemy , file uploaded client. bit google on error message brings me this source file:" wrapped object not bytes or buffer, error"
binaries = [] f in request.files.values(): if f , allowed_file(f.filename): fn = secure_filename(f.filename) file_path = os.path.join(basedir, fn) f.save(file_path) #data = f.read() data = open(fn, 'rb').read() binaries.append(psycopg2.binary(data)) f.close() #does escaping mytable=mytable( ..., document1 = binaries[0] ... ) #model class mytable(mydb.model): document1 = mydb.column(mydb.largebinary())
Comments
Post a Comment