MilesCranmer commited on
Commit
36e5dde
·
unverified ·
1 Parent(s): bfcbc36

fix: deal with edgecase in sympify

Browse files
Files changed (1) hide show
  1. pysr/export_sympy.py +6 -1
pysr/export_sympy.py CHANGED
@@ -87,7 +87,12 @@ def pysr2sympy(
87
  **sympy_mappings,
88
  }
89
 
90
- return sympify(equation, locals=local_sympy_mappings, evaluate=False)
 
 
 
 
 
91
 
92
 
93
  def assert_valid_sympy_symbol(var_name: str) -> None:
 
87
  **sympy_mappings,
88
  }
89
 
90
+ try:
91
+ return sympify(equation, locals=local_sympy_mappings, evaluate=False)
92
+ except TypeError as e:
93
+ if "got an unexpected keyword argument 'evaluate'" in str(e):
94
+ return sympify(equation, locals=local_sympy_mappings)
95
+ raise TypeError(f"Error processing equation '{equation}'") from e
96
 
97
 
98
  def assert_valid_sympy_symbol(var_name: str) -> None: