[python-win32] python and 'byte array'

Mark Hammond mhammond at skippinet.com.au
Wed Aug 4 15:02:07 CEST 2004


> 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')?

If you have run makepy for the object, passing a string will work (it
already knows a byte array is expected, so converts it).

If you havent't run makepy, pass buffer(the_string) - this will mean that
Python guesses byte-array as the type (where passing a string itself results
in guessing VT_BSTR)

Mark.



More information about the Python-win32 mailing list