Skip to content

Commit

Permalink
Merge pull request #348 from Dessia-tech/fix/stream_file
Browse files Browse the repository at this point in the history
fix(stream_file): fix bug
  • Loading branch information
Tanguylo authored Feb 2, 2024
2 parents f362f3b + 6be76ce commit bb1ec26
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Add reference_path to all Primitive / Elementary drawing Objects
- Remove data attr from class Arc in Python
- Light improvement of class Arc in Python
- Html stream method

## [0.21.0]
### Add
Expand Down
4 changes: 2 additions & 2 deletions plot_data/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,12 @@ def _to_html(self, debug_mode: bool = False, canvas_id: str = 'canvas', version:
def to_html_stream(self, stream, debug_mode: bool = False, canvas_id: str = 'canvas', version: str = None):
""" Export current Figure to its equivalent html stream file. """
html = self._to_html(debug_mode=debug_mode, canvas_id=canvas_id, version=version)
stream.write(html.encode('utf-8'))
stream.write(html)

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

Expand Down

0 comments on commit bb1ec26

Please sign in to comment.