mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-28 01:19:31 +00:00
changed ValueError to ImportError (#5006)
# changed ValueError to ImportError in except Several places with this bug. ValueError does not catch ImportError.
This commit is contained in:
parent
080eb1b3fc
commit
2ab0e1d526
@ -15,7 +15,7 @@ class Wikipedia(Docstore):
|
|||||||
try:
|
try:
|
||||||
import wikipedia # noqa: F401
|
import wikipedia # noqa: F401
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ValueError(
|
raise ImportError(
|
||||||
"Could not import wikipedia python package. "
|
"Could not import wikipedia python package. "
|
||||||
"Please install it with `pip install wikipedia`."
|
"Please install it with `pip install wikipedia`."
|
||||||
)
|
)
|
||||||
|
@ -58,7 +58,7 @@ class ArxivAPIWrapper(BaseModel):
|
|||||||
)
|
)
|
||||||
values["arxiv_result"] = arxiv.Result
|
values["arxiv_result"] = arxiv.Result
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ValueError(
|
raise ImportError(
|
||||||
"Could not import arxiv python package. "
|
"Could not import arxiv python package. "
|
||||||
"Please install it with `pip install arxiv`."
|
"Please install it with `pip install arxiv`."
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,7 @@ class WikipediaAPIWrapper(BaseModel):
|
|||||||
wikipedia.set_lang(values["lang"])
|
wikipedia.set_lang(values["lang"])
|
||||||
values["wiki_client"] = wikipedia
|
values["wiki_client"] = wikipedia
|
||||||
except ImportError:
|
except ImportError:
|
||||||
raise ValueError(
|
raise ImportError(
|
||||||
"Could not import wikipedia python package. "
|
"Could not import wikipedia python package. "
|
||||||
"Please install it with `pip install wikipedia`."
|
"Please install it with `pip install wikipedia`."
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user