[python-win32] python and 'byte array'
Ruslan
alienoid at is.lg.ua
Thu Aug 5 00:03:16 CEST 2004
РСÑд, 04.08.2004, в 16:02, Mark Hammond пиÑеÑ:
> > 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.
>
>
Thanks you ever so much. buffer(string) solved my problem, but need to
note - i have run makepy on winhttp.dll because without it i couldn't
use Option property to set option, only to read, after running makepy i
was able to set property with generated SetOption method. Dunno why, but
only explicitly writing buffer(str) solves my problem. Anyway thanks for
your help and for your great product.
Best regards,
Ruslan
More information about the Python-win32
mailing list