[python-win32] python and 'byte array'

Ruslan alienoid at is.lg.ua
Wed Aug 4 11:08:10 CEST 2004


Hello.

I use win32com package to call WinHTTP COM methods.
One of them is 'Send'. I can pass string parameter to 'Send' method from
python - it's OK, but to send binary data i need somehow pass in 'Send'
method data of _byte array_ type(Visual Basic type). Does anybody know
how to mimic that 'byte array' type of Visual Basic in Python (i need to
pass big chunks of binary data in 'Send')?

-------------
fin = open('binary.dat', 'rb')
body = fin.read()
fin.close()
-------------

As a result the 'body' is of type 'string' and i need somehow make it
similar to VB's 'byte array', otherwise 'Send(body)' just sends 10-15
bytes to server.

I tried struct.pack, but that doesn't seem to be an option.

Thanks in advance.
Your help is very appreciated.

Best regards,
Ruslan




More information about the Python-win32 mailing list