Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Traceback Error with --skip-text option #1455

Closed
FelixKrickl opened this issue Jan 8, 2025 · 1 comment
Closed

[Bug]: Traceback Error with --skip-text option #1455

FelixKrickl opened this issue Jan 8, 2025 · 1 comment
Assignees

Comments

@FelixKrickl
Copy link

Describe the bug

On Windows 10, ocrmypdf (version 16.6.0, installed like in the readthedocs.io manual) has issues in regards of the JBIG2 utility from texlive. Since I don't know if ocrmypdf is even supposed to use this it might also be an error due to PATH-variable settings. Despite getting the output that I needed, there was also an Traceback Error from Python3.12, see the codeblock.

Steps to reproduce

1. Download pdf from https://epub.uni-regensburg.de/10399/1/Dissertation_Zhao.pdf into your current working directory.
2. run the ocr command:
`ocrmypdf.exe --skip-text Dissertation_Zhao.pdf out.pdf`

Files

No response

How did you download and install the software?

No response

OCRmyPDF version

16.6.0

Relevant log output

Scanning contents     ---------------------------------------- 100% 124/124 0:00:00
Start processing 8 pages concurrently                                                                                                                            ocr.py:96
    1 skipping all processing on this page                                                                                                                _pipeline.py:335
    2 skipping all processing on this page                                                                                                                _pipeline.py:335
    3 skipping all processing on this page                                                                                                                _pipeline.py:335
    4 skipping all processing on this page                                                                                                                _pipeline.py:335
    5 skipping all processing on this page                                                                                                                _pipeline.py:335
    6 skipping all processing on this page                                                                                                                _pipeline.py:335
    7 skipping all processing on this page                                                                                                                _pipeline.py:335
    8 skipping all processing on this page                                                                                                                _pipeline.py:335
    9 skipping all processing on this page                                                                                                                _pipeline.py:335
   10 skipping all processing on this page                                                                                                                _pipeline.py:335
   11 skipping all processing on this page                                                                                                                _pipeline.py:335
   12 skipping all processing on this page                                                                                                                _pipeline.py:335
   13 skipping all processing on this page                                                                                                                _pipeline.py:335
   14 skipping all processing on this page                                                                                                                _pipeline.py:335
   15 skipping all processing on this page                                                                                                                _pipeline.py:335
   16 skipping all processing on this page                                                                                                                _pipeline.py:335
   17 skipping all processing on this page                                                                                                                _pipeline.py:335
   18 skipping all processing on this page                                                                                                                _pipeline.py:335
   19 skipping all processing on this page                                                                                                                _pipeline.py:335
   20 skipping all processing on this page                                                                                                                _pipeline.py:335
   21 skipping all processing on this page                                                                                                                _pipeline.py:335
   22 skipping all processing on this page                                                                                                                _pipeline.py:335
   23 skipping all processing on this page                                                                                                                _pipeline.py:335
   24 skipping all processing on this page                                                                                                                _pipeline.py:335
   25 skipping all processing on this page                                                                                                                _pipeline.py:335
   26 skipping all processing on this page                                                                                                                _pipeline.py:335
   27 skipping all processing on this page                                                                                                                _pipeline.py:335
   28 skipping all processing on this page                                                                                                                _pipeline.py:335
   29 skipping all processing on this page                                                                                                                _pipeline.py:335
   30 skipping all processing on this page                                                                                                                _pipeline.py:335
   31 skipping all processing on this page                                                                                                                _pipeline.py:335
   32 skipping all processing on this page                                                                                                                _pipeline.py:335
   33 skipping all processing on this page                                                                                                                _pipeline.py:335
   34 skipping all processing on this page                                                                                                                _pipeline.py:335
   35 skipping all processing on this page                                                                                                                _pipeline.py:335
   36 skipping all processing on this page                                                                                                                _pipeline.py:335
   37 skipping all processing on this page                                                                                                                _pipeline.py:335
   38 skipping all processing on this page                                                                                                                _pipeline.py:335
   39 skipping all processing on this page                                                                                                                _pipeline.py:335
   40 skipping all processing on this page                                                                                                                _pipeline.py:335
   41 skipping all processing on this page                                                                                                                _pipeline.py:335
   42 skipping all processing on this page                                                                                                                _pipeline.py:335
   43 skipping all processing on this page                                                                                                                _pipeline.py:335
   44 skipping all processing on this page                                                                                                                _pipeline.py:335
   45 skipping all processing on this page                                                                                                                _pipeline.py:335
   46 skipping all processing on this page                                                                                                                _pipeline.py:335
   47 skipping all processing on this page                                                                                                                _pipeline.py:335
   48 skipping all processing on this page                                                                                                                _pipeline.py:335
   49 skipping all processing on this page                                                                                                                _pipeline.py:335
   50 skipping all processing on this page                                                                                                                _pipeline.py:335
   51 skipping all processing on this page                                                                                                                _pipeline.py:335
   52 skipping all processing on this page                                                                                                                _pipeline.py:335
   53 skipping all processing on this page                                                                                                                _pipeline.py:335
   54 skipping all processing on this page                                                                                                                _pipeline.py:335
   55 skipping all processing on this page                                                                                                                _pipeline.py:335
   56 skipping all processing on this page                                                                                                                _pipeline.py:335
   57 skipping all processing on this page                                                                                                                _pipeline.py:335
   58 skipping all processing on this page                                                                                                                _pipeline.py:335
   59 skipping all processing on this page                                                                                                                _pipeline.py:335
   60 skipping all processing on this page                                                                                                                _pipeline.py:335
   61 skipping all processing on this page                                                                                                                _pipeline.py:335
   62 skipping all processing on this page                                                                                                                _pipeline.py:335
   63 skipping all processing on this page                                                                                                                _pipeline.py:335
   64 skipping all processing on this page                                                                                                                _pipeline.py:335
   65 skipping all processing on this page                                                                                                                _pipeline.py:335
   66 skipping all processing on this page                                                                                                                _pipeline.py:335
   67 skipping all processing on this page                                                                                                                _pipeline.py:335
   68 skipping all processing on this page                                                                                                                _pipeline.py:335
   69 skipping all processing on this page                                                                                                                _pipeline.py:335
   70 skipping all processing on this page                                                                                                                _pipeline.py:335
   71 skipping all processing on this page                                                                                                                _pipeline.py:335
   72 skipping all processing on this page                                                                                                                _pipeline.py:335
   73 skipping all processing on this page                                                                                                                _pipeline.py:335
   74 skipping all processing on this page                                                                                                                _pipeline.py:335
   75 skipping all processing on this page                                                                                                                _pipeline.py:335
   76 skipping all processing on this page                                                                                                                _pipeline.py:335
   77 skipping all processing on this page                                                                                                                _pipeline.py:335
   78 skipping all processing on this page                                                                                                                _pipeline.py:335
   79 skipping all processing on this page                                                                                                                _pipeline.py:335
   80 skipping all processing on this page                                                                                                                _pipeline.py:335
   81 skipping all processing on this page                                                                                                                _pipeline.py:335
   82 skipping all processing on this page                                                                                                                _pipeline.py:335
   83 skipping all processing on this page                                                                                                                _pipeline.py:335
   84 skipping all processing on this page                                                                                                                _pipeline.py:335
   85 skipping all processing on this page                                                                                                                _pipeline.py:335
   86 skipping all processing on this page                                                                                                                _pipeline.py:335
   87 skipping all processing on this page                                                                                                                _pipeline.py:335
   88 skipping all processing on this page                                                                                                                _pipeline.py:335
   89 skipping all processing on this page                                                                                                                _pipeline.py:335
   90 skipping all processing on this page                                                                                                                _pipeline.py:335
   91 skipping all processing on this page                                                                                                                _pipeline.py:335
   92 skipping all processing on this page                                                                                                                _pipeline.py:335
   93 skipping all processing on this page                                                                                                                _pipeline.py:335
   94 skipping all processing on this page                                                                                                                _pipeline.py:335
   95 skipping all processing on this page                                                                                                                _pipeline.py:335
   96 skipping all processing on this page                                                                                                                _pipeline.py:335
   97 skipping all processing on this page                                                                                                                _pipeline.py:335
   98 skipping all processing on this page                                                                                                                _pipeline.py:335
   99 skipping all processing on this page                                                                                                                _pipeline.py:335
  100 skipping all processing on this page                                                                                                                _pipeline.py:335
  101 skipping all processing on this page                                                                                                                _pipeline.py:335
  102 skipping all processing on this page                                                                                                                _pipeline.py:335
  103 skipping all processing on this page                                                                                                                _pipeline.py:335
  104 skipping all processing on this page                                                                                                                _pipeline.py:335
  105 skipping all processing on this page                                                                                                                _pipeline.py:335
  106 skipping all processing on this page                                                                                                                _pipeline.py:335
  107 skipping all processing on this page                                                                                                                _pipeline.py:335
  108 skipping all processing on this page                                                                                                                _pipeline.py:335
  109 skipping all processing on this page                                                                                                                _pipeline.py:335
  110 skipping all processing on this page                                                                                                                _pipeline.py:335
  111 skipping all processing on this page                                                                                                                _pipeline.py:335
  112 skipping all processing on this page                                                                                                                _pipeline.py:335
  113 skipping all processing on this page                                                                                                                _pipeline.py:335
  114 skipping all processing on this page                                                                                                                _pipeline.py:335
  115 skipping all processing on this page                                                                                                                _pipeline.py:335
  116 skipping all processing on this page                                                                                                                _pipeline.py:335
  117 skipping all processing on this page                                                                                                                _pipeline.py:335
  118 skipping all processing on this page                                                                                                                _pipeline.py:335
  119 skipping all processing on this page                                                                                                                _pipeline.py:335
  120 skipping all processing on this page                                                                                                                _pipeline.py:335
  121 skipping all processing on this page                                                                                                                _pipeline.py:335
  122 skipping all processing on this page                                                                                                                _pipeline.py:335
  123 skipping all processing on this page                                                                                                                _pipeline.py:335
  124 skipping all processing on this page                                                                                                                _pipeline.py:335
OCR                   ---------------------------------------- 100% 124/124 0:00:00
Postprocessing...                                                                                                                                               ocr.py:144
PDF/A conversion      ---------------------------------------- 100% 124/124 0:00:00
Linearizing           ---------------------------------------- 100% 100/100 0:00:00
Recompressing JPEGs   ----------------------------------------   0% 0/0 -:--:--
Deflating JPEGs       ----------------------------------------   0% 0/0 -:--:--
JBIG2                 ----------------------------------------   0% 0/0 -:--:--
Image optimization did not improve the file - optimizations will not be used                                                                               optimize.py:728
Command '['C:\\texlive\\2024\\bin\\windows\\jbig2.EXE', '--version']' returned non-zero exit status 3.                                                     __init__.py:174
Traceback (most recent call last):
  File
"C:\Users\co39xof\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ocrmypdf\sub
process\__init__.py", line 158, in get_version
    proc = run(
           ^^^^
  File
"C:\Users\co39xof\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.12_qbz5n2kfra8p0\LocalCache\local-packages\Python312\site-packages\ocrmypdf\sub
process\__init__.py", line 62, in run
    proc = subprocess_run(args, env=env, check=check, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.12_3.12.2288.0_x64__qbz5n2kfra8p0\Lib\subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['C:\\texlive\\2024\\bin\\windows\\jbig2.EXE', '--version']' returned non-zero exit status 3.
[WinError 2] Das System kann die angegebene Datei nicht finden                                                                                              _windows.py:99
Image optimization ratio: 0.97 savings: -2.8%                                                                                                             _pipeline.py:994
Total file size ratio: 0.95 savings: -5.1%                                                                                                                _pipeline.py:997
Output file is a PDF/A-2B (as expected)                                                                                                                     _common.py:472
@FelixKrickl FelixKrickl added the triage Issue needs triage label Jan 8, 2025
@FelixKrickl FelixKrickl changed the title [Bug]: [Bug]: Traceback Error with --skip-text option Jan 8, 2025
@jbarlow83
Copy link
Collaborator

Yes, I seem to recall this came up many years ago. texlive's jbig2 isn't compatible.

I'm most of the way to create a Python/Rust library that handles jbig2 to avoid shelling out to that subprocess, which is a problem for many... just need to get there. As such I won't bother making the checks more robust.

@github-actions github-actions bot removed the triage Issue needs triage label Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants