unsigned char array -> buffer

Diez B. Roggisch deetsNOSPAM at web.de
Mon Oct 18 18:11:35 CEST 2004


Henri Schomaecker wrote:
> as I already wrote, I'm trying to get image binary data into a var holding
> an unsigned char string and then print it directly to the browser.
> I now already did some tries with an array and now found the buffer()
> function. - I thought I would have the solution now and also changed
> stdout to O_BINARY, but still I don't get the data right:
> 
> 8<--------8<--------8<--------8<--------8<--------
> 
> imgObj = win32com.client.Dispatch("mine.imgsender")
> myImgData = buffer(imgObj.getImgData())
> 
> msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
> sys.stdout.write(myImgData)
> 
> 8<--------8<--------8<--------8<--------8<--------
> 
> I'm really lost and would be very thankful if someone could help me with
> that.

That snipplet of code is totally useless, as none of us has your custom
mine.imgsender lying around his harddisk, so we can't possibly know what
data you get, let alone what data you want.

So if you provided us with the actual data that is returned by getImgData we
might be able to help.

-- 
Regards,

Diez B. Roggisch



More information about the Python-list mailing list