RapidOCR does not return the expected value

1 week ago 3
ARTICLE AD BOX

When I directly run the code, it returned normally. But when i run it through shortcut, the file text.txt has no change.

#!/usr/bin/env python3 from rapidocr_onnxruntime import RapidOCR import opencc import pyautogui import datetime import os import time # Define the Path now = datetime.datetime.now().strftime("%Y-%m-%d_%H-%M-%S") path = f"/home/datdoan/Learning/Han_hoc/screenshots_ocr/{now}.png" # Take screen shot screenshot = pyautogui.screenshot() screenshot.save(path) time.sleep(1) # Extract the text engine = RapidOCR() result, elapse = engine(path) # Convert to Traditional Char(Rapid_OCR only extract to Sim) """sim_tra_converter = opencc.OpenCC('s2t.json') result = sim_tra_converter.convert(result)""" # Save to file text(for test) with open('text.txt', 'w') as f: f.write(str(result))
Read Entire Article