-
-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IOError: [Errno cairo returned CAIRO_STATUS_WRITE_ERROR: error while writing to output stream] 11 #49
Comments
Can write file
|
Ok… let’s try a smaller test case: import cairocffi
cairocffi.ImageSurface(cairocffi.FORMAT_ARGB32, 100, 100).write_to_png('test.png') |
file test.png written |
It looks like finding the root cause will unfortunately require non-trivial debugging :/ I can’t do it through github like we’ve done so far. |
No idea. Could you try to use an absolute path? (something like |
Same result |
I had the exact same problem (or at least the same error message) but for what ever reason adding viewBox="0 0 800 800" to the svg element fixed it for me. Minimal failing case: Minimal working version: |
@mkv123 Is this with CairoSVG? |
Yes. Here's a run with the failing case: $ cairosvg test.svg -f PNG> test.png
Traceback (most recent call last):
File "/usr/local/bin/cairosvg", line 25, in <module>
cairosvg.main()
File "/usr/local/lib/python2.7/site-packages/cairosvg/__init__.py", line 93, in main
SURFACES[output_format.upper()].convert(**kwargs)
File "/usr/local/lib/python2.7/site-packages/cairosvg/surface/__init__.py", line 87, in convert
cls(tree, output, dpi).finish()
File "/usr/local/lib/python2.7/site-packages/cairosvg/surface/__init__.py", line 421, in finish
self.cairo.write_to_png(self.output)
File "/usr/local/lib/python2.7/site-packages/cairocffi/surfaces.py", line 594, in write_to_png
self._pointer, write_func, ffi.NULL))
File "/usr/local/lib/python2.7/site-packages/cairocffi/__init__.py", line 69, in _check_status
raise exception(message, status)
IOError: [Errno cairo returned CAIRO_STATUS_WRITE_ERROR: error while writing to output stream] 11 |
The error is not really explicit in cairocffi, but CairoSVG is the culprit here. If you don't want to check for unusual strange cases (surface with a 0×0 size for example), you can safely close this bug. |
Thanks, mkv123! Adding the viewbox fixed me too. |
Environment
OSX Yosemite
System python 2.7
I'm completely new to the use of cairo. I have a case for converting svg files to png.
I found cairosvg as a suitable tool for this.
I had a lot of problems in installing cairo/py2cairo so at the end I decided to use cairocffi.
The text was updated successfully, but these errors were encountered: