不要将字符串传递给
storbinary。您应该将文件或文件对象(内存映射文件)传递给它。另外,此行应为
temp =StringIO.StringIO()。所以:
temp = StringIO.StringIO() # this is a file objectim.save(temp, format="png") # save the content to tempftp.storbinary('STOR Obama.jpg', temp) # upload temp
不要将字符串传递给
storbinary。您应该将文件或文件对象(内存映射文件)传递给它。另外,此行应为
temp =StringIO.StringIO()。所以:
temp = StringIO.StringIO() # this is a file objectim.save(temp, format="png") # save the content to tempftp.storbinary('STOR Obama.jpg', temp) # upload temp