unsigned char array -> buffer

Henri Schomaecker hs at byteconcepts.de
Tue Oct 19 20:34:04 EDT 2004


Many thanks for the interest, 
I found it out by myself now:

I just didn't realise the special behaviour of pythons print command.
I printed out the Content-type with the print command and didn't notice the
behaviour to add a newline automatically. So I had three newlines between
the Content-type line and the imagedata. It looked like the setting of
stdout to binary mode didn't work.

This works: 

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

imgObj = win32com.client.Dispatch("mine.imgsender")

msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)

print 'Content-Type: image/jpeg\n'
sys.stdout.write(imgObj.getImgData())

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

The most stupid mistakes are the hardest to find ;-)
Anyway, now everything is great.
Many thanks,
    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