hiroi-sora / Umi-OCR

OCR software, free and offline. 开源、免费的离线OCR软件。支持截屏/批量导入图片,PDF文档识别,排除水印/页眉页脚,扫描/生成二维码。内置多国语言库。
MIT License
27.63k stars 2.77k forks source link

I cant run umi ocr without running it on cmd #306

Closed ghost closed 10 months ago

ghost commented 10 months ago

title as it is, using 2.0.1 paddleocr edition on windows10 pro 22h2

hiroi-sora commented 10 months ago

This bug occurs in systems where the system language is not Simplified Chinese and will be fixed in the next release. In the meantime, you can manually update the code to fix the bug:

  1. Open UmiOCR-data/main.py with Notepad or any text editor.

  2. Find these lines of code:

    # 尝试获取控制台的输出对象
    try:
        fd = os.open("CONOUT$", os.O_RDWR | os.O_BINARY)
        fp = os.fdopen(fd, "w")
    except Exception as e:
        fp = open(os.devnull, "w")
  3. Add 【, encoding="utf-8"】 after the two "w"s, so it looks like this:

    # 尝试获取控制台的输出对象
    try:
        fd = os.open("CONOUT$", os.O_RDWR | os.O_BINARY)
        fp = os.fdopen(fd, "w", encoding="utf-8")
    except Exception as e:
        fp = open(os.devnull, "w", encoding="utf-8")
  4. Save the file. You should now be able to start the Umi-OCR.exe normally.

ghost commented 10 months ago

thanks!