Eureka! After the function returned I did a print on getmembers(buffer)
and I found the data (except for the pipe character).
If the function had returned all port values I would expect it to return:
OEA, IOA, OEB, IOB, OEC, IOC, OED, IOD, OEE, IOE
which I expected to look like:
0x8B, 0x09, 0x00, 0x00, 0xFF, 0x00, 0xFE, 0xB1, 0xFF, 0x00
what I got back was
"('raw', '\x8b|\x00\x00\xff\x00\xfe\xb1\xff\x00\x00\x00\x00..."
I find the suggestion below very relevant, since I would rather not pass a
string buffer to get a byte array back. So I will need to pass a different arg
when I want to get back say, a string descriptor or something.
If you really want to handle the result as hex byte values, you can use
struct or array:
import struct
s = '\x8b|'
t = struct.unpack('BB', s )
print [hex(i) for i in t]
import array
x = array('B')
x.fromstring( s )
t = x.tolist()
print [hex(i) for i in t]
_______________________________________________
python-win32 mailing list
[email protected]
http://mail.python.org/mailman/listinfo/python-win32