MilesCranmer commited on
Commit
9437ef6
1 Parent(s): 3a9acd3

Ensure files are read as utf-8

Browse files
Files changed (1) hide show
  1. pysr/sr.py +2 -2
pysr/sr.py CHANGED
@@ -2189,7 +2189,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
2189
  cur_filename = str(self.equation_file_) + f".out{i}" + ".bkup"
2190
  if not os.path.exists(cur_filename):
2191
  cur_filename = str(self.equation_file_) + f".out{i}"
2192
- with open(cur_filename, "r") as f:
2193
  buf = f.read()
2194
  buf = _preprocess_julia_floats(buf)
2195
 
@@ -2200,7 +2200,7 @@ class PySRRegressor(MultiOutputMixin, RegressorMixin, BaseEstimator):
2200
  filename = str(self.equation_file_) + ".bkup"
2201
  if not os.path.exists(filename):
2202
  filename = str(self.equation_file_)
2203
- with open(filename, "r") as f:
2204
  buf = f.read()
2205
  buf = _preprocess_julia_floats(buf)
2206
  all_outputs = [self._postprocess_dataframe(pd.read_csv(StringIO(buf)))]
 
2189
  cur_filename = str(self.equation_file_) + f".out{i}" + ".bkup"
2190
  if not os.path.exists(cur_filename):
2191
  cur_filename = str(self.equation_file_) + f".out{i}"
2192
+ with open(cur_filename, "r", encoding="utf-8") as f:
2193
  buf = f.read()
2194
  buf = _preprocess_julia_floats(buf)
2195
 
 
2200
  filename = str(self.equation_file_) + ".bkup"
2201
  if not os.path.exists(filename):
2202
  filename = str(self.equation_file_)
2203
+ with open(filename, "r", encoding="utf-8") as f:
2204
  buf = f.read()
2205
  buf = _preprocess_julia_floats(buf)
2206
  all_outputs = [self._postprocess_dataframe(pd.read_csv(StringIO(buf)))]