mirror of
https://github.com/hwchase17/langchain.git
synced 2025-07-21 12:01:47 +00:00
community: fix import exception too constrictive (#30218)
Fix this issue #30097
This commit is contained in:
parent
7ff7c4f81b
commit
f6a17fbc56
@ -45,6 +45,11 @@ class BaseImageBlobParser(BaseBlobParser):
|
||||
"""
|
||||
try:
|
||||
from PIL import Image as Img
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"`Pillow` package not found, please install it with "
|
||||
"`pip install Pillow`"
|
||||
)
|
||||
|
||||
with blob.as_bytes_io() as buf:
|
||||
if blob.mimetype == "application/x-npy":
|
||||
@ -57,11 +62,6 @@ class BaseImageBlobParser(BaseBlobParser):
|
||||
page_content=content,
|
||||
metadata={**blob.metadata, **{"source": blob.source}},
|
||||
)
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"`Pillow` package not found, please install it with "
|
||||
"`pip install Pillow`"
|
||||
)
|
||||
|
||||
|
||||
class RapidOCRBlobParser(BaseImageBlobParser):
|
||||
|
Loading…
Reference in New Issue
Block a user