Improve error messages formatting in doc loaders (#4586)

# Cosmetic in errors formatting

Added appropriate spacing to the `ImportError` message in a bunch of
document loaders to enhance trace readability (including Google Drive,
Youtube, Confluence and others). This change ensures that the error
messages are not displayed as a single line block, and that the `pip
install xyz` commands can be copied to clipboard from terminal easily.

## Who can review?

@eyurtsev
parallel_dir_loader
Andrea Pinto 1 year ago committed by GitHub
parent 570d057db4
commit 1e5d25b93c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -40,8 +40,8 @@ class ImageCaptionLoader(BaseLoader):
from transformers import BlipForConditionalGeneration, BlipProcessor
except ImportError:
raise ValueError(
"transformers package not found, please install with"
"`pip install transformers`"
"`transformers` package not found, please install with "
"`pip install transformers`."
)
processor = BlipProcessor.from_pretrained(self.blip_processor)
@ -67,7 +67,7 @@ class ImageCaptionLoader(BaseLoader):
from PIL import Image
except ImportError:
raise ValueError(
"PIL package not found, please install with `pip install pillow`"
"`PIL` package not found, please install with `pip install pillow`"
)
try:

@ -194,7 +194,7 @@ class PDFMinerLoader(BasePDFLoader):
from pdfminer.high_level import extract_text # noqa:F401
except ImportError:
raise ValueError(
"pdfminer package not found, please install it with "
"`pdfminer` package not found, please install it with "
"`pip install pdfminer.six`"
)
@ -222,7 +222,7 @@ class PDFMinerPDFasHTMLLoader(BasePDFLoader):
from pdfminer.high_level import extract_text_to_fp # noqa:F401
except ImportError:
raise ValueError(
"pdfminer package not found, please install it with "
"`pdfminer` package not found, please install it with "
"`pip install pdfminer.six`"
)
@ -256,7 +256,7 @@ class PyMuPDFLoader(BasePDFLoader):
import fitz # noqa:F401
except ImportError:
raise ValueError(
"PyMuPDF package not found, please install it with "
"`PyMuPDF` package not found, please install it with "
"`pip install pymupdf`"
)

@ -22,7 +22,7 @@ class S3FileLoader(BaseLoader):
import boto3
except ImportError:
raise ValueError(
"Could not import boto3 python package. "
"Could not import `boto3` python package. "
"Please install it with `pip install boto3`."
)
s3 = boto3.client("s3")

Loading…
Cancel
Save