diff --git a/Main.py b/Main.py index c014206..4c97cff 100644 --- a/Main.py +++ b/Main.py @@ -20,8 +20,8 @@ stopThread = False filename_adresslist = "" adresslist = "" step = 0 -s = Service(ChromeDriverManager().install()) -driver = webdriver.Chrome(service=s) +service = Service(ChromeDriverManager().install()) +driver = webdriver.Chrome(service=service) driver.minimize_window() outputtext = "Welcome to application Sonnendach\n" columnIndexes = [] @@ -33,15 +33,17 @@ def search_adresses(adress_list, filename_adresslist, driver): global stopThread global columnIndexes + #Create Direcotrys to save screenshots and qrcodes if they don't exist yet. if(not os.path.exists("screenshots")): os.makedirs("screenshots", exist_ok=False) if (not os.path.exists("qrcodes")): os.makedirs("qrcodes", exist_ok=False) + #Search for each adress in the list and create screenshots and qrcodes for i in range(len(adress_list)): line = adress_list[i] adress = line.split(file_split_char) - if((line != adress_list[0]) & ((adress[columnIndexes[4]] == ""))): + if((line != adress_list[0]) & (adress[columnIndexes[4]] == "") & (len((adress[columnIndexes[0]]) > 0)) & (len(adress[columnIndexes[1]] > 0)) & (len(adress[columnIndexes[2]] > 0)) & (len(adress[columnIndexes[3]] > 0))): print(adress) search_string = adress[columnIndexes[0]] + " " + adress[columnIndexes[1]] + " " + adress[columnIndexes[2]] + " " + adress[columnIndexes[3]] search_bar = driver.find_element(By.ID, "searchTypeahead1") @@ -61,7 +63,6 @@ def search_adresses(adress_list, filename_adresslist, driver): if(found): time.sleep(2) - # TODO: Validation url = driver.current_url eignung = driver.find_element(By.ID, "eignung").text pv_Production50 = driver.find_element(By.ID, "pv50").text.replace("'", "") diff --git a/RenameFiles.py b/RenameFiles.py index 1fb1a41..7930c3c 100644 --- a/RenameFiles.py +++ b/RenameFiles.py @@ -10,11 +10,11 @@ print("select Directory:") filename_Directory = filedialog.askdirectory() root.withdraw print(filename_Directory) -adress_file = open(filename_Filelist, "r", encoding='utf-8') +adress_file = open(filename_Filelist, "r") address_list = adress_file.read().splitlines() for adress in address_list: - filenames = adress.split(";") + filenames = adress.split(",") try: os.rename(filename_Directory + "/" + filenames[0], filename_Directory + "/" + filenames[1]) except: