Mostly working with Product + Version and Sku + Version.
There will still be many errors. But this is working somewhat
This commit is contained in:
@ -2,30 +2,28 @@ import re # noqa: F401
|
||||
import socket # noqa: F401
|
||||
import sys # noqa: F401
|
||||
|
||||
from arq import Retry
|
||||
|
||||
|
||||
async def sent_to_printer(ctx: dict, data: str, address: str, cut_code: str):
|
||||
address = "/printer"
|
||||
try:
|
||||
print("Printing to :", address, "\n", data, "\n")
|
||||
with open(address, "w") as printer:
|
||||
printer.write(data)
|
||||
printer.write("\n")
|
||||
print(cut_code)
|
||||
printer.write(cut_code)
|
||||
except LookupError as e:
|
||||
print("Lookup error:", e)
|
||||
raise Retry(defer=ctx["job_try"] * 30)
|
||||
except FileNotFoundError as e:
|
||||
print("File not found error:", e)
|
||||
raise Retry(defer=ctx["job_try"] * 30)
|
||||
except: # noqa: E722
|
||||
print("Unexpected error:", sys.exc_info()[0])
|
||||
# retry the job with increasing back-off
|
||||
# delays will be 5s, 10s, 15s, 20s
|
||||
# after max_tries (default 5) the job will permanently fail
|
||||
raise Retry(defer=ctx["job_try"] * 30)
|
||||
# try:
|
||||
print("Printing to :", address, "\n", data, "\n")
|
||||
# with open(address, "w") as printer:
|
||||
# printer.write(data)
|
||||
# printer.write("\n")
|
||||
# print(cut_code)
|
||||
# printer.write(cut_code)
|
||||
# except LookupError as e:
|
||||
# print("Lookup error:", e)
|
||||
# raise Retry(defer=ctx["job_try"] * 30)
|
||||
# except FileNotFoundError as e:
|
||||
# print("File not found error:", e)
|
||||
# raise Retry(defer=ctx["job_try"] * 30)
|
||||
# except: # noqa: E722
|
||||
# print("Unexpected error:", sys.exc_info()[0])
|
||||
# # retry the job with increasing back-off
|
||||
# # delays will be 5s, 10s, 15s, 20s
|
||||
# # after max_tries (default 5) the job will permanently fail
|
||||
# raise Retry(defer=ctx["job_try"] * 30)
|
||||
|
||||
# GS = "\x1d"
|
||||
# PAPER_CUT = GS + "\x56"
|
||||
|
||||
Reference in New Issue
Block a user