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]: watcher.py: execute_ocrmypdf() takes 0 positional arguments but 1 positional argument were given #1183

Closed
Major2828 opened this issue Nov 3, 2023 · 1 comment
Assignees
Labels

Comments

@Major2828
Copy link

What were you trying to do?

I use following docker compose file to run ocrmypdf:

---
version: "3.3"
services:
  ocrmypdf:
    restart: always
    container_name: ocrmypdf
    image: jbarlow83/ocrmypdf:latest
    volumes:
      - "input:/input"
      - "output:/output"
      - "archiv:/processed"
      - ./settings.json:/settings.json
    environment:
      - OCR_OUTPUT_DIRECTORY_YEAR_MONTH=0
      - OCR_ON_SUCCESS_ARCHIVE=1
      - OCR_DESKEW=1
      - OCR_LOGLEVEL=DEBUG
      - OCR_USE_POLLING=1
      - OCR_JSON_SETTINGS=/settings.json
      - PYTHONUNBUFFERED=1
    user: "1000:1000"
    entrypoint: python3
    command: watcher.py

Everything seems fine but as soon as I copy a pdf to the input folder ocrmypdf crashes with the error message below.
Do you have any idea what it could be?

here my settings file:

{"rotate_pages": true,
"clean": true,
"language": "deu+eng"
}

Where are you installing from?

Docker container

What operating system are you working on?

Linux

Relevant log output

Starting OCRmyPDF watcher with config:
Input Directory: /input
Output Directory: /output
Output Directory Year & Month: False
Archive Directory: /processed
INPUT_DIRECTORY: /input
OUTPUT_DIRECTORY: /output
OUTPUT_DIRECTORY_YEAR_MONTH: False
ARCHIVE_DIRECTORY: /processed
ON_SUCCESS_DELETE: False
ON_SUCCESS_ARCHIVE: True
DESKEW: True
ARGS: <_io.TextIOWrapper name='/settings.json' mode='r' encoding='UTF-8'>
POLL_NEW_FILE_SECONDS: 1
RETRIES_LOADING_FILE: 5
USE_POLLING: True
LOGLEVEL: DEBUG
Watching /input for new PDFs. Press Ctrl+C to exit.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/dist-packages/watchdog/observers/api.py", line 204, in run
    self.dispatch_events(self.event_queue)
  File "/usr/local/lib/python3.10/dist-packages/watchdog/observers/api.py", line 380, in dispatch_events
    handler.dispatch(event)
  File "/usr/local/lib/python3.10/dist-packages/watchdog/events.py", line 424, in dispatch
    super().dispatch(event)
  File "/usr/local/lib/python3.10/dist-packages/watchdog/events.py", line 275, in dispatch
    self.on_any_event(event)
  File "/app/watcher.py", line 149, in on_any_event
    execute_ocrmypdf(event.src_path, **self._settings)
TypeError: execute_ocrmypdf() takes 0 positional arguments but 1 positional argument (and 9 keyword-only arguments) were given
@nischi
Copy link

nischi commented Nov 15, 2023

Hi @jbarlow83
I do get the same eror, with the newest Version. I tried already with and without a json setting file. Same result. Do you have any idea why this happen?

docker run
  -d
  --name='ocrmypdf'
  --net='eth0'
  --ip='myip'
  -e TZ="Europe/Berlin"
  -e 'OCR_ON_SUCCESS_DELETE'='1'
  -e 'OCR_OUTPUT_DIRECTORY_YEAR_MONTH'='1'
  -e 'OCR_DESKEW'='1'
  -e 'PYTHONBUFFERED'='1'
  -e 'OCR_ON_SUCCESS_ARCHIVE'='0'
  -e 'OCR_POLL_NEW_FILE_SECONDS'='60'
  -e 'OCR_USE_POLLING'='1'
  -e 'OCR_LOGLEVEL'='DEBUG'
  -e 'OCR_JSON_SETTINGS'='/settings/ocrmypdf_settings.json'
  -l net.unraid.docker.managed=dockerman
  -v '/mnt/remotes/unsort/':'/input':'rw'
  -v '/mnt/remotes/ocr':'/output':'rw'
  -v '/mnt/remotes/processed':'/processed':'rw'
  -v '/mnt/remotes/settings':'/settings':'rw'
  --entrypoint python3 'jbarlow83/ocrmypdf' watcher.py
Starting OCRmyPDF watcher with config:
Input Directory: /input
Output Directory: /output
Output Directory Year & Month: True
Archive Directory: /processed
INPUT_DIRECTORY: /input
OUTPUT_DIRECTORY: /output
OUTPUT_DIRECTORY_YEAR_MONTH: True
ARCHIVE_DIRECTORY: /processed
ON_SUCCESS_DELETE: True
ON_SUCCESS_ARCHIVE: False
DESKEW: True
ARGS: <_io.TextIOWrapper name='/settings/ocrmypdf_settings.json' mode='r' encoding='UTF-8'>
POLL_NEW_FILE_SECONDS: 60
RETRIES_LOADING_FILE: 5
USE_POLLING: True
LOGLEVEL: DEBUG
Watching /input for new PDFs. Press Ctrl+C to exit.
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/usr/local/lib/python3.10/dist-packages/watchdog/observers/api.py", line 204, in run
    self.dispatch_events(self.event_queue)
  File "/usr/local/lib/python3.10/dist-packages/watchdog/observers/api.py", line 380, in dispatch_events
    handler.dispatch(event)
  File "/usr/local/lib/python3.10/dist-packages/watchdog/events.py", line 424, in dispatch
    super().dispatch(event)
  File "/usr/local/lib/python3.10/dist-packages/watchdog/events.py", line 275, in dispatch
    self.on_any_event(event)
  File "/app/watcher.py", line 149, in on_any_event
    execute_ocrmypdf(event.src_path, **self._settings)
TypeError: execute_ocrmypdf() takes 0 positional arguments but 1 positional argument (and 9 keyword-only arguments) were given

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants