Skip to content

Commit

Permalink
Better error handling for import error
Browse files Browse the repository at this point in the history
  • Loading branch information
MilesCranmer committed Feb 3, 2022
1 parent b1eaa8d commit 5d9233a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pysr/sr.py
Expand Up @@ -1050,13 +1050,14 @@ def _run(self, X, y, weights, variable_names):
Main.eval(
f'Pkg.activate("{_escape_filename(self.julia_project)}", io={io})'
)
from julia.api import JuliaError
try:
if update:
Main.eval(f"Pkg.resolve(io={io})")
Main.eval(f"Pkg.instantiate(io={io})")
else:
Main.eval(f"Pkg.instantiate(io={io})")
except RuntimeError as e:
except (JuliaError, RuntimeError) as e:
raise ImportError(import_error_string(self.julia_project)) from e
Main.eval("using SymbolicRegression")

Expand Down

0 comments on commit 5d9233a

Please sign in to comment.