get binary data from COM object

Henri Schomaecker hs at byteconcepts.de
Sun Oct 17 10:39:06 EDT 2004


Hi folks,

I'm trying to get back jpg binary-data from a COM object, passed as
SafeArray of bytes by the object and print it right to the user agent.

example:
8<--------8<--------8<--------8<--------8<--------

imgObj = win32com.client.Dispatch("mine.imgsender")
myImgData = imgObj.getImgData()
# But myImgData should get it in binary format,
# what it isn't like that.

8<--------8<--------8<--------8<--------8<--------

Unfortunately I'm not familiar enought with python, so I ask you for help.
Note: At the moment, there's no method provided by the COM object which
gives back the size of the image.

I already tried it with...
myImgData = array('B', imgObj.getImgData())
... but the compiler told me, I couldn't do this.

Every help is greatly appreciated, many thanks in advance,
    yours Henri

-- 
| Henri Schomäcker - BYTECONCEPTS, VIRTUAL HOMES
|     Datendesign für Internet und Intranet
|         http://www.byteconcepts.de
|         http://www.virtual-homes.de



More information about the Python-list mailing list