to_html_stream TypeError: string argument expected, got 'bytes'
Closed this issue · 0 comments
-
I'm submitting a ...
- bug report
- feature request
- support request => Please do not submit support request here, see note at the top of this template.
-
What is the current behavior?
I Tried to export a plot_data html to stream with Figure.to_html_stream with a StringFile from dessia_common -
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Avoid reference to other packages
I generated a plot_data.core.PrimitiveGroup and applied:
from dessia_common.files import StringFile
stream1 = StringFile('test')
primitive_group.to_html_stream(stream1)
I have the following error:
File "c:\users\mack\documents\git\plot_data\plot_data\core.py", line 138, in to_html_stream
stream.write(html.encode('utf-8'))
TypeError: string argument expected, got 'bytes'
New information 30/01/2024:
with BinaryFile it works well.
-
What is the expected behavior?
Have the html written in the stream. -
What is the motivation / use case for changing the behavior?
Customer -
Possible fixes
encode('utf-8')
transform string in octet, perhaps change it ? -
Please tell us about your environment:
- branch: master
- commit: v0.22.0 (same error on v0.17.3)
- python version: 3.9.13