import subprocess import os from os.path import expanduser home = expanduser("~") mainCategory = "" subCategory = "" numberOfPages = -1 print("") #Try to get the URI of the printer at the file in ~/.local/share/scan-auto/printer_uri try: f = open(home+"/.local/share/scan-auto/printer_uri", "r") print("Printer URI is:") print(f.readline()) printerURI = f.readline() except: print("Please create a file at " + home + "/.local/share/scan-auto/printer_uri") print("And populate it with the hp-probe URI of your printer, e.g: escl:https://192.168.X.XX:443") exit() while mainCategory == "": try: mainCategory = str(input("Main category of document: ")) except: mainCategory = "" if mainCategory == "": #Not best way to do this, but it's a small script, so idc :shrug: os.system("clear") print("Invalid input, please try again:") #Keep the terminal clean :) print("") while subCategory == "": try: subCategory = str(input("Subcategory of document: ")) except: subCategory = "" if subCategory == "": #Not best way to do this, but it's a small script, so idc :shrug: os.system("clear") print("Invalid input, please try again:") print("") while numberOfPages <= 0: try: numberOfPages = int(input("Number of pages for document: ")) except: numberOfPages = -1 if numberOfPages <= 0: #Not best way to do this, but it's a small script, so idc :shrug: os.system("clear") print("Invalid input, please try again:")