From c7e71c5b7dd00eb7644b6ea1d4e48fb4ebb0fca0 Mon Sep 17 00:00:00 2001 From: ada <> Date: Tue, 15 Nov 2022 14:45:19 +0100 Subject: [PATCH] only print when i want --- script.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/script.py b/script.py index 7fe8f94..d9c77cd 100644 --- a/script.py +++ b/script.py @@ -57,7 +57,9 @@ def quantifier (words): #print(type(objects)) #print(objects) def dotprint(text): - os.system('echo "'+text+'"> /dev/usb/lp0') + printerpath = '/dev/usb/lp0' + if os.path.exists(printerpath): + os.system(f'echo "{text}"> { printerpath }') print(text) #object = ["teammate", "card", "turn", "place", "board", "dice", "nice", "backgammon"] #verb = ["choose", "pick", "give", "burn", "cut"]