Skip to content

Commit bb1ec26

Browse files
authored
Merge pull request #348 from Dessia-tech/fix/stream_file
fix(stream_file): fix bug
2 parents f362f3b + 6be76ce commit bb1ec26

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1515
- Add reference_path to all Primitive / Elementary drawing Objects
1616
- Remove data attr from class Arc in Python
1717
- Light improvement of class Arc in Python
18+
- Html stream method
1819

1920
## [0.21.0]
2021
### Add

plot_data/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,12 +135,12 @@ def _to_html(self, debug_mode: bool = False, canvas_id: str = 'canvas', version:
135135
def to_html_stream(self, stream, debug_mode: bool = False, canvas_id: str = 'canvas', version: str = None):
136136
""" Export current Figure to its equivalent html stream file. """
137137
html = self._to_html(debug_mode=debug_mode, canvas_id=canvas_id, version=version)
138-
stream.write(html.encode('utf-8'))
138+
stream.write(html)
139139

140140
def to_html(self, filepath: str = None, debug_mode: bool = False, canvas_id: str = 'canvas', version: str = None):
141141
""" Export current Figure to an HTML file given by the filepath. """
142142
filepath = make_filepath(filepath=filepath)
143-
with open(filepath, 'wb') as file:
143+
with open(filepath, 'w', encoding="utf-8") as file:
144144
self.to_html_stream(file, debug_mode=debug_mode, canvas_id=canvas_id, version=version)
145145
return filepath
146146

0 commit comments

Comments
 (0)