Skip to content

Commit

Permalink
update the error message
Browse files Browse the repository at this point in the history
  • Loading branch information
dipinknair committed Dec 20, 2024
1 parent bac8094 commit f4e44b5
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/ansys/tools/path/path.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,8 +1109,6 @@ def _mechanical_version_from_path(path: str) -> int:
"""
# expect v<ver>/ansys
# replace \\ with / to account for possible windows path
if path is None:
raise Exception("Path is None")
matches = re.findall(r"v(\d\d\d)", path.replace("\\", "/"), re.IGNORECASE)
if not matches:
raise RuntimeError(f"Unable to extract Mechanical version from {path}.")
Expand Down Expand Up @@ -1159,9 +1157,9 @@ def version_from_path(product: PRODUCT_TYPE, path: str) -> int:
"""
if not isinstance(path, str):
raise ValueError(
f"Provided path '{path}' is not valid string."
"Check if the {product} is installed in default location"
"If not use 'save-ansys-path' to save the path."
f"Provided path '{path}' is not valid string. "
"Check if the {product} is installed in default location. "
"If not use ``save-ansys-path`` to save the path."
)
if product == "mechanical":
return _mechanical_version_from_path(path)
Expand Down

0 comments on commit f4e44b5

Please sign in to comment.