diff --git a/ppocr/utils/utility.py b/ppocr/utils/utility.py index 83504da4a6..e044a3b678 100644 --- a/ppocr/utils/utility.py +++ b/ppocr/utils/utility.py @@ -120,7 +120,7 @@ def check_and_read(img_path): elif os.path.basename(img_path)[-3:].lower() == "pdf": from paddle.utils import try_import - try_import("fitz") + fitz = try_import("fitz") from PIL import Image imgs = [] diff --git a/ppstructure/pdf2word/pdf2word.py b/ppstructure/pdf2word/pdf2word.py index cd21ba12b9..06ae555598 100644 --- a/ppstructure/pdf2word/pdf2word.py +++ b/ppstructure/pdf2word/pdf2word.py @@ -21,10 +21,9 @@ import cv2 import platform import numpy as np -import fitz from paddle.utils import try_import -try_import("fitz") +fitz = try_import("fitz") from PIL import Image from pdf2docx.converter import Converter from qtpy.QtWidgets import (