python + byte array

R

Ruslan

Hi, everybody.

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')?
I tried struct.pack, but that doesn't seem to be an option.

Thanks in advance.
Your help is very appreciated.

Best regards,
Ruslan
 
P

Peter Hansen

Ruslan said:
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')?
I tried struct.pack, but that doesn't seem to be an option.

Strings are probably what you are looking for... in Python a string
is basically an array of bytes.
 
M

Michel Claveau - abstraction méta-galactique non t

Hi !

But COM's string parameters are in Unicode, not bytes array.
And win32Com convert auto strings parameters in Unicode.

Ruslan : see, also, cTypes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,202
Messages
2,571,057
Members
47,666
Latest member
selsetu

Latest Threads

Top