Commit 95f949d1 authored by Radek Hušek's avatar Radek Hušek
Browse files

do not crash if lpstat fails

parent 68cf94cc
...@@ -78,11 +78,14 @@ class CPP(QWidget): ...@@ -78,11 +78,14 @@ class CPP(QWidget):
self._printers = self._config.get("printers", []) self._printers = self._config.get("printers", [])
self._printers.append(("Save as ...", self._save_as_file)) self._printers.append(("Save as ...", self._save_as_file))
for l in sp.check_output(["lpstat", "-a"]).decode("UTF-8").split("\n"): try:
p = l.split(" ")[0] for l in sp.check_output(["lpstat", "-a"]).decode("UTF-8").split("\n"):
if p == "": p = l.split(" ")[0]
continue if p == "":
self._printers.append((p, ["lp", "-d", p])) continue
self._printers.append((p, ["lp", "-d", p]))
except:
pass
def init_gui(self): def init_gui(self):
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment