473,505 Members | 14,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Jul 18 '05 #1
2 6684
Ruslan wrote:
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.
Jul 18 '05 #2
Hi !

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

Ruslan : see, also, cTypes


Jul 18 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

22
3195
by: Kamilche | last post by:
I've looked at a few alternatives for encryption with Python, and didn't come up anything very speedy. I've written an encryption algorithm in pure Python that can process 22 megs of data a...
23
3152
by: Simon Hengel | last post by:
Hello, we are hosting a python coding contest an we even managed to provide a price for the winner... http://pycontest.net/ The contest is coincidentally held during the 22c3 and we will be...
15
2325
by: Claudio Grondi | last post by:
Let's consider a test source code given at the very end of this posting. The question is if Python allows somehow access to the bytes of the representation of a long integer or integer in...
5
1430
by: Hendrik van Rooyen | last post by:
Is there a canonical way to address the bits in a structure like an array or string or struct? Or alternatively, is there a good way to combine eight ints that represent bits into one of the...
13
3877
by: Liang Chen | last post by:
Hope you all had a nice weekend. I have a question that I hope someone can help me out. I want to run a Python program that uses Tkinter for the user interface (GUI). The program allows me to type...
6
8365
by: ogtheterror | last post by:
Hi I have a very limited understanding of Python and have given this the best shot i have but still have not been able to get it working. Is there anyone that knows how to get this into a .net...
0
7216
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7098
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
7018
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7471
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5613
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
5028
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4699
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3176
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1528
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.