Skip to content

Commit

Permalink
changed ValueError to ImportError (langchain-ai#5006)
Browse files Browse the repository at this point in the history
# changed ValueError to ImportError in except

Several places with this bug. ValueError does not catch ImportError.
  • Loading branch information
leo-gan authored May 19, 2023
1 parent 080eb1b commit 2ab0e1d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion langchain/docstore/wikipedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ def __init__(self) -> None:
try:
import wikipedia # noqa: F401
except ImportError:
raise ValueError(
raise ImportError(
"Could not import wikipedia python package. "
"Please install it with `pip install wikipedia`."
)
Expand Down
2 changes: 1 addition & 1 deletion langchain/utilities/arxiv.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def validate_environment(cls, values: Dict) -> Dict:
)
values["arxiv_result"] = arxiv.Result
except ImportError:
raise ValueError(
raise ImportError(
"Could not import arxiv python package. "
"Please install it with `pip install arxiv`."
)
Expand Down
2 changes: 1 addition & 1 deletion langchain/utilities/wikipedia.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def validate_environment(cls, values: Dict) -> Dict:
wikipedia.set_lang(values["lang"])
values["wiki_client"] = wikipedia
except ImportError:
raise ValueError(
raise ImportError(
"Could not import wikipedia python package. "
"Please install it with `pip install wikipedia`."
)
Expand Down

0 comments on commit 2ab0e1d

Please sign in to comment.