Hi,
I have problem with sending raw string data via socket. I made communication between PC(python script) and labeler Markem Imaje. Labeler has RS232 and converter Ethernet/RS232 and i have to send raw string data to converter with out any changes for example:
\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\...
if I do something like this is working and labeler take mesage:
for example when I want change string to bytes
\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\... python send:
b'\x01\xc2\x81\xc2\xaav\x00]D\x00\x00\x00\x00WG_
My question is, how can I send raw data string as bytes with out any changes?
PLS help
P.S. I tried make variable string with b' - variable = b'\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\' - but it didn't work
I have problem with sending raw string data via socket. I made communication between PC(python script) and labeler Markem Imaje. Labeler has RS232 and converter Ethernet/RS232 and i have to send raw string data to converter with out any changes for example:
\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\...
if I do something like this is working and labeler take mesage:
if labeler_connect_status: try: labeler_socket.send(b'\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\...') print('DATA_SEND') except: print('ERROR_SEND') labeler_connect_status = Falsebut I have many different message and i want put raw string to variable:
if labeler_connect_status: variable = \x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\... try: labeler_socket.send(b'variable')#I know it doesn't work, but I want something like that print('DATA_SEND') except: print('ERROR_SEND') labeler_connect_status = FalseI tried many options but it doesn't work because python try to encodes my data to UTF-8, ASCII...
for example when I want change string to bytes
\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\... python send:
b'\x01\xc2\x81\xc2\xaav\x00]D\x00\x00\x00\x00WG_
My question is, how can I send raw data string as bytes with out any changes?
PLS help
P.S. I tried make variable string with b' - variable = b'\x01\x81\xaa\x76\x00\x5d\x44\x00\x00\x00\x00\x57\x47\x5f\' - but it didn't work