plotly / Kaleido

Fast static image export for web-based visualization libraries with zero dependencies

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unexpected error while fetching topojson file

acardoco opened this issue · comments

Hello! My work environment has been built with virtualenv, python 3.8 and I have plotly version 5.6 and the latest version of kaleido installed.

I have encountered the following error when I try to save the image in offline mode (without Internet access):

... raise ValueError( ValueError: Transform failed with error code 525: unexpected error while fetching topojson file at https://cdn.plot.ly/world_110m.json

I have already tried to pass the file as path, which does not take it well, as URI, which does not parse it well. I've also tried calling low-level API functions and it keeps giving me the same error.

Has anyone tried running the write_image() function offline?

Here is my main code:

` import plotly.graph_objects as go

        self._plot = go.Figure()
	core_plot = go.Choropleth(
		locations=geodata["country_code"],
		geojson=str(self.topojson_path),
		z=geodata['ip'],
		text=geodata['country'],
		colorscale='bluyl',
		autocolorscale=False,
		reversescale=False,
		marker_line_color='darkgray',
		marker_line_width=0.5,
		colorbar_title='Number'
	)
	self._plot.add_traces(core_plot)
	self._plot.update_layout(
		title_text='Title',
		title_x=0.5,
		geo_scope=self.geo_scope,  
		geo=dict(showframe=True, showcoastlines=True, projection_type='equirectangular'),
		annotations=[]
	)

	self._plot.write_image(self.image_path, scale=1.5)`

All the best

@acardoco were you able to resolve this issue?