Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 14126

Send GSD Command in JSON to Zebra Printer

$
0
0

Trying to send commands (not labels) to Zebra printers using Python.

On page 574 of the documentation it shows:enter image description here

Here's my code:

mysocket = socket.socket(socket.AF_INET,socket.SOCK_STREAM)          host= "192.168.100.245" # verified IP address of Zebra printerport = 9100mysocket.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?


Viewing all articles
Browse latest Browse all 14126

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>