python + byte array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Ruslan

    #1

    python + byte array

    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

  • Peter Hansen

    #2
    Re: python + byte array

    Ruslan wrote:
    [color=blue]
    > 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.[/color]

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

    Comment

    • Michel Claveau - abstraction méta-galactique non t

      #3
      Re: python + byte array

      Hi !

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

      Ruslan : see, also, cTypes






      Comment

      Working...