diff --git a/inventree_phomemo/phomemo_label.py b/inventree_phomemo/phomemo_label.py index 5b2141b..456948e 100644 --- a/inventree_phomemo/phomemo_label.py +++ b/inventree_phomemo/phomemo_label.py @@ -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))