From 326594c3246f739c6fdc4aef1bf8f5409141e9ea Mon Sep 17 00:00:00 2001 From: suzan Date: Tue, 29 Nov 2022 15:48:24 +0100 Subject: [PATCH] Update 'cutting.py' --- cutting.py | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/cutting.py b/cutting.py index 7feb430..bebdb3c 100644 --- a/cutting.py +++ b/cutting.py @@ -2,13 +2,20 @@ import os print("starting the pruning process") scanning = "sudo scanimage --resolution 300 --mode color -o image.png" os.system(scanning) -os.system("tesseract image.png text.txt -l eng") -fantasyname = open("text.txt.txt" , "r") +os.system("tesseract image.png image -l eng") +fantasyname = open("image.txt" , "r") fantasyname = fantasyname.readlines() -for line in fantasyname: - line = line.split(" ") - for l in line: - if l!="" or l != ['\n', '\r\n']: - print(l) - os.system("echo '"+l+"' > /dev/usb/lp0") +text = open("image.txt", "r").read() +print(text) +print("------") +lines = text.split("\n") +for line in lines: + dotprint = f'echo "{line}" > /dev/usb/lp0' + os.system(dotprint) +#for line in fantasyname: + #line = line.split(" ") + #for l in line: + #if l!="" or l != ['\n', '\r\n']: + #print(l) + #os.system("echo '"+l+"' > /dev/usb/lp0")