Hello!

I try to add attachments using proteus (4.0) using the following code:
# p=Product.find(blabla)
                img = Attachment()
                with open(filename, "rb") as imageFile:
                    f = imageFile.read()
                    b = bytearray(f)
                img.type = 'data'
                img.name = filenamewithoutpath
                img.resource = p
                img.data = b
                img.save()



-- 
You received this message because you are subscribed to the Google Groups 
"tryton" group.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tryton/cdb89b55-d1f4-46b0-8bbb-bea7b57df5ac%40googlegroups.com.

Reply via email to