fix(label): Socket sending
This commit is contained in:
parent
77864ba979
commit
a732fb3d4a
1 changed files with 3 additions and 1 deletions
|
@ -66,12 +66,14 @@ class PhomemoLabelPlugin(LabelPrintingMixin, SettingsMixin, InvenTreePlugin):
|
|||
'ppk': key
|
||||
}
|
||||
|
||||
data = json.dumps(fields)
|
||||
|
||||
# Send the label to the printer
|
||||
try:
|
||||
print_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
print_socket.settimeout(5)
|
||||
print_socket.connect((ip_address, port))
|
||||
json.dump(fields, print_socket)
|
||||
print_socket.sendall(bytes(data,encoding="utf-8"))
|
||||
print_socket.close()
|
||||
except Exception as error:
|
||||
raise ConnectionError('Error connecting to printer server: ' + str(error))
|
||||
|
|
Loading…
Add table
Reference in a new issue