Skip to content
This repository has been archived by the owner on Apr 16, 2024. It is now read-only.

Commit

Permalink
Fixed a bug when API response with an error_code
Browse files Browse the repository at this point in the history
  • Loading branch information
tumuidle committed Jun 12, 2022
1 parent b37e4df commit b54056d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Empty file added utils/win32/__init__.py
Empty file.
3 changes: 3 additions & 0 deletions window.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ def translate(self):
for t in text_lst:
text = text + t
result = translator.baidu.translate(self.appid, self.api_key, text).json()
if result.get("error_code") is not None:
print("[Window] Unable to get translation")
return
self.pte_result.setPlainText(translator.baidu.analyse_result(result))

def run(ocr_reader: easyocr.Reader,
Expand Down

0 comments on commit b54056d

Please sign in to comment.