Merge branch 'dev' into feature-ocrmypdf

This commit is contained in:
Jonas Winkler
2020-11-25 16:58:20 +01:00
7 changed files with 146 additions and 5 deletions

View File

@@ -5,7 +5,8 @@ from django.core.checks import Error, register
def get_tesseract_langs():
with subprocess.Popen(['tesseract', '--list-langs'], stdout=subprocess.PIPE) as p:
with subprocess.Popen(['tesseract', '--list-langs'],
stdout=subprocess.PIPE) as p:
stdout, stderr = p.communicate()
return stdout.decode().strip().split("\n")[1:]
@@ -15,7 +16,7 @@ def get_tesseract_langs():
def check_default_language_available(app_configs, **kwargs):
langs = get_tesseract_langs()
if not settings.OCR_LANGUAGE in langs:
if settings.OCR_LANGUAGE not in langs:
return [Error(
f"The default ocr language {settings.OCR_LANGUAGE} is "
f"not installed. Paperless cannot OCR your documents "