diff --git a/src/components/os_label_printer.py b/src/components/os_label_printer.py index ccab0a4..2801b60 100644 --- a/src/components/os_label_printer.py +++ b/src/components/os_label_printer.py @@ -64,16 +64,14 @@ class Os_Label_Printer(Component): label_file = "tmp/label.prn" with open(label_file, "w", errors="surrogateescape") as f: f.write(label_file_contents) - if self.platform == "windows": + if platform.system().lower() == "windows": cmd = f'print /d:"{self.printer}" "{label_file}"' - elif self.platform == "cups": - cmd = f'lp -d "{self.printer}" "{label_file}"' else: - raise NotImplementedError(f"platform {self.platform!r} is not supported") + cmd = f'lp -d "{self.printer}" "{label_file}"' if not self.simulate: p = subprocess.run(cmd, stderr=subprocess.STDOUT, stdout=subprocess.PIPE, shell=True) # unsafe if p.returncode != 0: - self.log.exception(f"failed to print: returncode: {p.returncode}\noutput:\n{p.stdout}") + self.log.exception(f"failed to print: return code: {p.returncode}\noutput:\n{p.stdout}") QMessageBox.critical( None, "Errore Stampante",