OSError: [Errno cairo returned CAIRO_STATUS_WRITE_ERROR: b'error while writing to output stream'] 11
See original GitHub issuePython 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
Issue Analytics
- State:
- Created 4 years ago
- Comments:16 (7 by maintainers)
Top Results From Across the Web
b'error while writing to output stream' on Google Cloud ...
The cairosvg package can't render a SVG with relative heights or widths without a viewBox attribute on the svg element.
Read more >How to fix Cairo error 'error while writing to output stream'
when i run this code ggsave(), it tells me cairo error 'error while wirting to output stream'. Dose anyone know how to solve...
Read more >Error handling: Cairo: A Vector Graphics Library
A status value of CAIRO_STATUS_SUCCESS represents no error and has an integer value of zero. ... error while writing to output stream (Since...
Read more >Cannot export to Cairo PDF with localized characters in file path
Cannot export to Cairo PDF with localized characters in file path ... and Dia gives an error: "error while writing to export stream"....
Read more >outputStreams stops writing someti… | Apple Developer Forums
But the data transfer sometimes stops suddenly without any error and after a few minutes it ... extension OutputStream { func write(data: Data)...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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).
Code mistake ×png_file = open(“{}.png”.format(machine), “w”) ○png_file = open(“{}.png”.format(machine), “wb”)