Open rouilj opened 2 years ago
Running:
elif self.output_type == 'data:': image = chart.render_data_uri(is_unicode=True)
results in a traceback (with or without is_unicode being passed). Here is the traceback:
is_unicode
[/usr/lib/python3.6/base64.py](file://usr/lib/python3.6/base64.py) in b64encode(s='<svg xmlns:xlink="http://www.w3.org/1999/xlink" ...gends" transform="translate(390, 82)"/></g></svg>', altchars=None) 56 application to e.g. generate url or filesystem safe Base64 strings. 57 """ 58 encoded = binascii.b2a_base64(s, newline=False) encoded = undefined, global binascii = <module 'binascii' (built-in)>, global b2a_base64 = undefined, s = '<svg xmlns:xlink="http://www.w3.org/1999/xlink" ...gends" transform="translate(390, 82)"/></g></svg>', global newline = undefined 59 if altchars is not None: 60 assert len(altchars) == 2, repr(altchars) [/usr/local/lib/python3.6/dist-packages/pygal/graph/public.py](file://usr/local/lib/python3.6/dist-packages/pygal/graph/public.py) in render_data_uri(self=<pygal.graph.pie.Pie object>, **kwargs={'force_uri_protocol': 'https', 'is_unicode': True}) 105 return "data:image/svg+xml;charset=utf-8;base64,%s" % ( 106 base64.b64encode( 107 self.render(**kwargs) self = <pygal.graph.pie.Pie object>, global render = undefined, kwargs = {'force_uri_protocol': 'https', 'is_unicode': True} 108 ).decode('utf-8').replace('\n', '') 109 )
looks like self.render() is returning a string when it needs to be bytes??
self.render()
Just wanted to chime in to say I have the same issue. It's easy enough to make a workaround, but we should fix this in pygal.
Running:
results in a traceback (with or without
is_unicode
being passed). Here is the traceback:looks like
self.render()
is returning a string when it needs to be bytes??