MilesCranmer commited on
Commit
228d437
2 Parent(s): 3a9acd3 2ae253a

Merge pull request #396 from MilesCranmer/encoding-fix

Browse files

Ensure files are read as utf-8 on all operating systems

Files changed (2) hide show
  1. pysr/sr.py +2 -2
  2. pysr/version.py +1 -1
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)))]
pysr/version.py CHANGED
@@ -1,2 +1,2 @@
1
- __version__ = "0.15.1"
2
  __symbolic_regression_jl_version__ = "0.21.3"
 
1
+ __version__ = "0.15.2"
2
  __symbolic_regression_jl_version__ = "0.21.3"