CairoSVG
CairoSVG copied to clipboard
ValueError: could not convert string to float: 'null'
Hello,
I get the below error when I try to convert my svg data to png
File [~\pythonEnv\lib\site-packages\cairosvg\surface.py:410](http://localhost:8888/lab/tree/GraphDL/~/pythonEnv/lib/site-packages/cairosvg/surface.py#line=409), in Surface.draw(self, node)
407 pass
409 # Get stroke and fill opacity
--> 410 stroke_opacity = float(node.get('stroke-opacity', 1))
411 fill_opacity = float(node.get('fill-opacity', 1))
412 if opacity < 1 and not node.children:
ValueError: could not convert string to float: 'null'
I was wondering how I can fix it?
best
That’s probably because CairoSVG doesn’t handle percentages for opacity. The solution is to allow them everywhere we parse *-opacity properties.