cairocffi: OSError: [Errno cairo returned CAIRO_STATUS_WRITE_ERROR: b'error while writing to output stream'] 11
Python 3.7.4 CairoSVG 2.4.2 Mac OS X 10.14.6
Input file: https://gist.github.com/brendabell/408c12703d92868ed73bcdf04cf92ec7
Note that I did include absolute height, width and viewBox. My code is as follows:
result = generator.generate()
text_file = open("{}.svg".format(machine), "w")
text_file.write(result)
text_file.close()
png_file = open("{}.png".format(machine), "w")
cairosvg.svg2png(bytestring=result,write_to=png_file)
png_file.close()
The generated SVG file seems to be perfect. I started getting the error after the following upgrades:
Python 2.7.16 -> 3.7.4 CairoSVG 1.0.22 -> 2.4.2
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Comments: 16 (7 by maintainers)
Commits related to this issue
- Raise an explicit error when no SVG size is defined Related to Kozea/cairocffi#49, Kozea/cairocffi#143. — committed to Kozea/CairoSVG by liZe 4 years ago
It works for me. This error happens when you cannot write to your destination file, you should check the rights set on your destination folder (and your destination file if it already exists).
I just found a work-around. Instead of this:
I now have this which works:
I think this is further evidence that it’s not a permissions problem.