You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import os
import plotly.express as px
import plotly.io as pio
pio.kaleido.scope.chromium_args = tuple([
arg for arg in pio.kaleido.scope.chromium_args if arg != "--disable-dev-shm-usage"
])
fig = px.scatter(px.data.iris(), x="sepal_length", y="sepal_width", color="species")
# tmp folder
tmp = os.path.join(os.getcwd(), 'tmp')
fig.write_image(os.path.join(tmp, '00.pdf'), engine="kaleido")
and still gives an error:
ValueError Traceback (most recent call last)
Input In [2], in <cell line: 11>()
9 # tmp folder
10 tmp = os.path.join(os.getcwd(), 'tmp')
---> 11 fig.write_image(os.path.join(tmp, '00.pdf'), engine="kaleido")
File ...lib/python3.10/site-packages/plotly/basedatatypes.py:3841, in BaseFigure.write_image(self, *args, **kwargs)
3781 """
3782 Convert a figure to a static image and write it to a file or writeable
3783 object
(...)
3837 None
3838 """
3839 import plotly.io as pio
-> 3841 return pio.write_image(self, *args, **kwargs)
File ...lib/python3.10/site-packages/plotly/io/_kaleido.py:266, in write_image(fig, file, format, scale, width, height, validate, engine)
250 raise ValueError(
251 """
252 Cannot infer image type from output path '{file}'.
(...)
260 )
261 )
263 # Request image
264 # -------------
265 # Do this first so we don't create a file if image conversion fails
--> 266 img_data = to_image(
267 fig,
268 format=format,
269 scale=scale,
270 width=width,
271 height=height,
272 validate=validate,
273 engine=engine,
274 )
276 # Open file
277 # ---------
278 if path is None:
279 # We previously failed to make sense of `file` as a pathlib object.
280 # Attempt to write to `file` as an open file descriptor.
File ...lib/python3.10/site-packages/plotly/io/_kaleido.py:143, in to_image(fig, format, width, height, scale, validate, engine)
140 # Validate figure
141 # ---------------
142 fig_dict = validate_coerce_fig_to_dict(fig, validate)
--> 143 img_bytes = scope.transform(
144 fig_dict, format=format, width=width, height=height, scale=scale
145 )
147 return img_bytes
File ...lib/python3.10/site-packages/kaleido/scopes/plotly.py:161, in PlotlyScope.transform(self, figure, format, width, height, scale)
159 if code != 0:
160 message = response.get("message", None)
--> 161 raise ValueError(
162 "Transform failed with error code {code}: {message}".format(
163 code=code, message=message
164 )
165 )
167 img = response.get("result").encode("utf-8")
169 # Base64 decode binary types
ValueError: Transform failed with error code 525: Cannot set property 'innerHTML' of null
I'm using a machine with Linux 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I installed conda with conda install -c conda-forge python-kaleido
And I have installed
Thanks for your interest in Kaleido. We are currently working on an overhaul that might address your issue - we hope to have news in a few weeks and will post an update then. Thanks - @gvwilson
Hello I'm having an issue in saving pdf from plotly images.
I can save them as html, svg, but not in pdf.
When I run
I get the error:
I tried a workaround with
and still gives an error:
I'm using a machine with
Linux 5.4.0-73-generic #82-Ubuntu SMP Wed Apr 14 17:39:42 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
I installed conda with
conda install -c conda-forge python-kaleido
And I have installed
Thank you.
The text was updated successfully, but these errors were encountered: