diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6aff93e..de590f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -19,6 +19,7 @@ jobs: fail-fast: true matrix: include: + - {name: '3.12', python: '3.12', os: ubuntu-20.04, tox: py312} - {name: '3.11', python: '3.11', os: ubuntu-20.04, tox: py311} - {name: '3.10', python: '3.10', os: ubuntu-20.04, tox: py310} - {name: '3.9', python: '3.9', os: ubuntu-20.04, tox: py39} diff --git a/pytesseract/pytesseract.py b/pytesseract/pytesseract.py index aee9306..37837f4 100644 --- a/pytesseract/pytesseract.py +++ b/pytesseract/pytesseract.py @@ -18,7 +18,6 @@ from os.path import normcase from os.path import normpath from os.path import realpath -from pkgutil import find_loader from tempfile import NamedTemporaryFile from time import sleep from typing import List @@ -32,14 +31,20 @@ tesseract_cmd = 'tesseract' -numpy_installed = find_loader('numpy') is not None -if numpy_installed: +try: from numpy import ndarray -pandas_installed = find_loader('pandas') is not None -if pandas_installed: + numpy_installed = True +except ModuleNotFoundError: + numpy_installed = False + +try: import pandas as pd + pandas_installed = True +except ModuleNotFoundError: + pandas_installed = False + LOGGER = logging.getLogger('pytesseract') DEFAULT_ENCODING = 'utf-8' diff --git a/setup.cfg b/setup.cfg index cdd8405..7145d1e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -20,6 +20,7 @@ classifiers = Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Programming Language :: Python :: Implementation :: CPython Programming Language :: Python :: Implementation :: PyPy