Skip to content

Commit

Permalink
fix(eda): set encoding to udf when file is opened
Browse files Browse the repository at this point in the history
  • Loading branch information
brandonlockhart committed Dec 20, 2020
1 parent d56e3b7 commit f43c1aa
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dataprep/eda/container.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def save(self, filename: str) -> None:
"""
save function
"""
with open(filename, "w") as f:
with open(filename, "w", encoding="utf-8") as f:
f.write(self.template_base.render(context=self.context))

def _repr_html_(self) -> str:
Expand Down Expand Up @@ -107,7 +107,7 @@ def show_browser(self) -> None:
# set delete = False to avoid early delete when user open multiple plots.
with NamedTemporaryFile(suffix=".html", delete=False) as tmpf:
pass
with open(tmpf.name, "w") as file:
with open(tmpf.name, "w", encoding="utf-8") as file:
file.write(self.template_base.render(context=self.context))
webbrowser.open_new_tab(f"file://{tmpf.name}")

Expand Down
2 changes: 1 addition & 1 deletion dataprep/eda/create_report/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ def save(
if not path.is_dir():
raise ValueError("The second parameter is not a valid path.")

with open(path / f"{filename}.html", "w") as file:
with open(path / f"{filename}.html", "w", encoding="utf-8") as file:
file.write(self.report)
print(f"Report has been saved to {path}/{filename}.html!")

Expand Down

0 comments on commit f43c1aa

Please sign in to comment.