Trying to send commands (not labels) to Zebra printers using Python.
On page 574 of the documentation it shows:

Here's my code:
mysocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)
host= "192.168.100.245" # verified IP address of Zebra printer
port = 9100
mysocket.connect((host, port))
name_string= '''"sgd.name":null'''
my_string= f'''{{}}{{{name_string}}}'''
x = json.dumps(obj=my_string)
mysocket.sendall(bytes(x,encoding="utf-8"))
data= mysocket.recv(1024)
print(data.decode('utf-8'))
The printer responds to pings and other non-JSON Zebra commands sent to it (i.e. mysocket.send(b"~hs")). However, with the code above I wait for a long time and no response returns from the printer.
Tried multiple variations of the JSON formatting, what should I try next?
Per @bruan comment I tried the following variations but did not work:
my_string= '''"sgd.name":null"'''
my_string= '''{}{"sgd.name":null}'''
'"{}{\\"sgd.name\\":null}"'. I think you should sendmy_stringas command. That said, better create JSON used in the command properlyx = json.dumps(obj=my_string)line? Second one looks right