Update the import of the printer package

This commit is contained in:
n07070
2026-05-18 23:19:21 +02:00
parent 6254d60429
commit b0e394f9d1

View File

@@ -1,5 +1,5 @@
# Importing the module to mage the connection to the printer. # Importing the module to manage the connection to the printer.
from escpos.printer import Usb, USBNotFoundError import escpos.printer as escp
from time import sleep, gmtime, strftime from time import sleep, gmtime, strftime
import os.path import os.path
from PIL import Image, ImageEnhance, ImageOps from PIL import Image, ImageEnhance, ImageOps
@@ -66,8 +66,8 @@ class Printer(object):
try: try:
# This also calls open(), which we need to close() # This also calls open(), which we need to close()
# or else the device will appear as busy. # or else the device will appear as busy.
p = Usb(self.device_id, self.vendor_id, 0, profile="TM-P80") p = escp.Usb(self.device_id, self.vendor_id, 0, profile="TM-P80")
except USBNotFoundError as e: except Exception as e:
self.app.logger.error( self.app.logger.error(
"The USB device is not plugged in, trying again : " + str(e) "The USB device is not plugged in, trying again : " + str(e)
) )