Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: madmaze/pytesseract
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: ed37e0139374555e4f5c22b6fcb92c7a64bea885
Choose a base ref
..
head repository: madmaze/pytesseract
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 6f20b6faa88c0a2f4021abe559e235e6d3098f04
Choose a head ref
Showing with 4 additions and 6 deletions.
  1. +1 −1 .github/workflows/ci.yaml
  2. +3 −5 pytesseract/pytesseract.py
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -41,7 +41,7 @@ jobs:
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV

- name: Install tesseract
run: sudo apt-get -y update && sudo apt-get install -y curl tesseract-ocr tesseract-ocr-fra
run: sudo apt-get -y update && sudo apt-get install -y libcurl4-openssl-dev tesseract-ocr tesseract-ocr-fra

- name: Print tesseract version
run: echo $(tesseract --version)
8 changes: 3 additions & 5 deletions pytesseract/pytesseract.py
Original file line number Diff line number Diff line change
@@ -124,7 +124,6 @@ def __init__(self):
'ALTO output not supported. Tesseract >= 4.1.0 required',
)


class URLNotSupported(EnvironmentError):
def __init__(self):
super().__init__(
@@ -218,9 +217,8 @@ def save(image):
with NamedTemporaryFile(prefix='tess_', delete=False) as f:
if isinstance(image, str):
if image.startswith('http:') or image.startswith('https:'):
if get_tesseract_version(
cached=True,
) < TESSERACT_URL_VERSION or not has_libcurl(cached=True):
if get_tesseract_version(cached=True) < TESSERACT_URL_VERSION\
or not has_libcurl(cached=True):
raise URLNotSupported()
yield f.name, image
else:
@@ -499,7 +497,7 @@ def has_libcurl():
)
except OSError:
raise TesseractNotFoundError()

return 'libcurl' in output.decode(DEFAULT_ENCODING)