ocrmypdf / OCRmyPDF

OCRmyPDF adds an OCR text layer to scanned PDF files, allowing them to be searched
http://ocrmypdf.readthedocs.io/
Mozilla Public License 2.0
14.13k stars 1.02k forks source link

Ubuntu 15.10: python3 exception - convert() got an unexpected keyword argument 'dpi' #47

Closed angelborroy-ks closed 8 years ago

angelborroy-ks commented 8 years ago

Install on Ubuntu 15.10

Software versions

$ ocrmypdf --version
3.2
$ python3 --version
Python 3.4.3+
$ unpaper -version
6.1

Exception (on every attempt)

$ ocrmypdf --verbose 1 --force-ocr scansmpl.pdf test.pdf

Original exception:

    Exception #1
      'builtins.TypeError(convert() got an unexpected keyword argument 'dpi')' raised in ...
       Task = def ocrmypdf.main.select_image_layer(...):
       Job  = [[.../com.github.ocrmypdf.aziws_b9/000001.image, .../com.github.ocrmypdf.aziws_b9/000001.ocr.page.pdf] -> .../com.github.ocrmypdf.aziws_b9/000001.image-layer.pdf, <ocrmypdf.main.WrappedLogger>, [{'width_inches': Decimal('8.48611'), 'width_pixels': 1696, 'pageno': 0, 'images': [{'dpi_h': Decimal('2E+2'), 'color': 'gray', 'width': 1696, 'comp': 1, 'dpi': Decimal('199.928'), 'height': 2175, 'bpc': 1, 'dpi_w': Decimal('199.856'), 'enc': 'ccitt'}], 'has_text': False, 'xres': Decimal('199.856'), 'height_inches': Decimal('10.875'), 'height_pixels': 2175, 'yres': Decimal('2E+2')}], <_thread.lock>]

    Traceback (most recent call last):
      File "/usr/local/lib/python3.4/dist-packages/ruffus/task.py", line 751, in run_pooled_job_without_exceptions
        register_cleanup, touch_files_only)
      File "/usr/local/lib/python3.4/dist-packages/ruffus/task.py", line 567, in job_wrapper_io_files
        ret_val = user_defined_work_func(*params)
      File "/usr/local/lib/python3.4/dist-packages/ocrmypdf/main.py", line 597, in select_image_layer
        img2pdf.convert([image], dpi=dpi, outputstream=pdf)
    TypeError: convert() got an unexpected keyword argument 'dpi'
jbarlow83 commented 8 years ago

Gah. One of the libraries I'm using just pushed out an API breaking change.

If you need a quick answer, follow the steps for installing OCRmyPDF in a development environment, and "pip install -r requirements.txt" to force it to use a compatible version of img2pdf.

On Fri, 5 Feb 2016 at 07:55 Angel Borroy notifications@github.com wrote:

Install on Ubuntu 15.10

Software versions

$ ocrmypdf --version 3.2 $ python3 --version Python 3.4.3+ $ unpaper -version 6.1

Exception (on every attempt)

$ ocrmypdf --verbose 1 --force-ocr scansmpl.pdf test.pdf

Original exception:

Exception #1
  'builtins.TypeError(convert() got an unexpected keyword argument 'dpi')' raised in ...
   Task = def ocrmypdf.main.select_image_layer(...):
   Job  = [[.../com.github.ocrmypdf.aziws_b9/000001.image, .../com.github.ocrmypdf.aziws_b9/000001.ocr.page.pdf] -> .../com.github.ocrmypdf.aziws_b9/000001.image-layer.pdf, <ocrmypdf.main.WrappedLogger>, [{'width_inches': Decimal('8.48611'), 'width_pixels': 1696, 'pageno': 0, 'images': [{'dpi_h': Decimal('2E+2'), 'color': 'gray', 'width': 1696, 'comp': 1, 'dpi': Decimal('199.928'), 'height': 2175, 'bpc': 1, 'dpi_w': Decimal('199.856'), 'enc': 'ccitt'}], 'has_text': False, 'xres': Decimal('199.856'), 'height_inches': Decimal('10.875'), 'height_pixels': 2175, 'yres': Decimal('2E+2')}], <_thread.lock>]

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/ruffus/task.py", line 751, in run_pooled_job_without_exceptions
    register_cleanup, touch_files_only)
  File "/usr/local/lib/python3.4/dist-packages/ruffus/task.py", line 567, in job_wrapper_io_files
    ret_val = user_defined_work_func(*params)
  File "/usr/local/lib/python3.4/dist-packages/ocrmypdf/main.py", line 597, in select_image_layer
    img2pdf.convert([image], dpi=dpi, outputstream=pdf)
TypeError: convert() got an unexpected keyword argument 'dpi'

— Reply to this email directly or view it on GitHub https://github.com/jbarlow83/OCRmyPDF/issues/47.

jbarlow83 commented 8 years ago

I suspect many people will run into this so I did a quick release.

v3.2.1 should fix this issue

On Fri, 5 Feb 2016 at 13:57 James R Barlow barlow.jim@gmail.com wrote:

Gah. One of the libraries I'm using just pushed out an API breaking change.

If you need a quick answer, follow the steps for installing OCRmyPDF in a development environment, and "pip install -r requirements.txt" to force it to use a compatible version of img2pdf.

On Fri, 5 Feb 2016 at 07:55 Angel Borroy notifications@github.com wrote:

Install on Ubuntu 15.10

Software versions

$ ocrmypdf --version 3.2 $ python3 --version Python 3.4.3+ $ unpaper -version 6.1

Exception (on every attempt)

$ ocrmypdf --verbose 1 --force-ocr scansmpl.pdf test.pdf

Original exception:

Exception #1
  'builtins.TypeError(convert() got an unexpected keyword argument 'dpi')' raised in ...
   Task = def ocrmypdf.main.select_image_layer(...):
   Job  = [[.../com.github.ocrmypdf.aziws_b9/000001.image, .../com.github.ocrmypdf.aziws_b9/000001.ocr.page.pdf] -> .../com.github.ocrmypdf.aziws_b9/000001.image-layer.pdf, <ocrmypdf.main.WrappedLogger>, [{'width_inches': Decimal('8.48611'), 'width_pixels': 1696, 'pageno': 0, 'images': [{'dpi_h': Decimal('2E+2'), 'color': 'gray', 'width': 1696, 'comp': 1, 'dpi': Decimal('199.928'), 'height': 2175, 'bpc': 1, 'dpi_w': Decimal('199.856'), 'enc': 'ccitt'}], 'has_text': False, 'xres': Decimal('199.856'), 'height_inches': Decimal('10.875'), 'height_pixels': 2175, 'yres': Decimal('2E+2')}], <_thread.lock>]

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/ruffus/task.py", line 751, in run_pooled_job_without_exceptions
    register_cleanup, touch_files_only)
  File "/usr/local/lib/python3.4/dist-packages/ruffus/task.py", line 567, in job_wrapper_io_files
    ret_val = user_defined_work_func(*params)
  File "/usr/local/lib/python3.4/dist-packages/ocrmypdf/main.py", line 597, in select_image_layer
    img2pdf.convert([image], dpi=dpi, outputstream=pdf)
TypeError: convert() got an unexpected keyword argument 'dpi'

— Reply to this email directly or view it on GitHub https://github.com/jbarlow83/OCRmyPDF/issues/47.

angelborroy-ks commented 8 years ago

Working softly now.

Thanks for your quick reaction.