diff --git a/gi_loadouts/face/scan/rule.py b/gi_loadouts/face/scan/rule.py index 60bfef2c..d77f9f83 100644 --- a/gi_loadouts/face/scan/rule.py +++ b/gi_loadouts/face/scan/rule.py @@ -237,8 +237,18 @@ def register_return_from_scanning(self, rslt: tuple) -> None: :return: """ + area, main, seco, team, levl, rare, duration, expt = rslt + + if expt: + self.show_dialog( + QMessageBox.Information, + "Faulty scanning", + f"Please consider checking your input after ensuring that the proper Tesseract OCR executable has been selected.\n\n{expt}" + ) + return + self.arti_shot.setPixmap(self.shot) - area, main, seco, team, levl, rare, duration = rslt + if area in [self.arti_dist.itemText(indx) for indx in range(self.arti_dist.count())]: self.arti_dist.setCurrentText(area) if team in [self.arti_type.itemText(indx) for indx in range(self.arti_type.count())]: diff --git a/gi_loadouts/face/scan/work.py b/gi_loadouts/face/scan/work.py index cd9f3d86..9f824b93 100644 --- a/gi_loadouts/face/scan/work.py +++ b/gi_loadouts/face/scan/work.py @@ -45,9 +45,13 @@ def scan_artifact(self) -> None: text = image_to_string(self.snap, lang=conf.tempname, config=f"--tessdata-dir {location}") except (OSError, TesseractError) as expt: if isinstance(expt, OSError): - raise OSError("Selected executable of Tesseract OCR is unfunctional.") from expt - elif isinstance(expt, TesseractError): - raise ValueError("Processing failed as either Tesseract OCR executable ceased to function or training data was tampered with.") from expt + expt = "Selected executable of Tesseract OCR is unfunctional." + else: + expt = "Processing failed as either Tesseract OCR executable ceased to function or training data was tampered with." + stoptime = time() + rslt = area, main, seco, team, levl, rare, (stoptime - strttime), expt + self.result.emit(rslt) + return # DISTRIBUTION AREA areadict = {} @@ -148,6 +152,6 @@ def scan_artifact(self) -> None: stoptime = time() - rslt = area, main, seco, team, levl, rare, (stoptime - strttime) + rslt = area, main, seco, team, levl, rare, (stoptime - strttime), None self.result.emit(rslt)