Comments (12)
@tooh Does the script have filesystem permissions to create test.png
in that current directory? What happens when you run python -c 'open("test.png", "w").close()'
?
@liZe, any other idea what this could be?
from cairocffi.
Can write file
==> ls *.png
test.png
from cairocffi.
Ok… let’s try a smaller test case:
import cairocffi
cairocffi.ImageSurface(cairocffi.FORMAT_ARGB32, 100, 100).write_to_png('test.png')
from cairocffi.
file test.png written
from cairocffi.
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.
from cairocffi.
No idea. Could you try to use an absolute path? (something like cairosvg test.svg -o /tmp/test.png
)
from cairocffi.
Same result
from cairocffi.
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:
<svg baseProfile="full" height="100%" version="1.1" width="100%" xmlns="http://www.w3.org/2000/svg"> <circle cx="50" cy="50" r="40" /> </svg>
Minimal working version:
`
``
from cairocffi.
@mkv123 Is this with CairoSVG?
from cairocffi.
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
from cairocffi.
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.
from cairocffi.
Thanks, mkv123!
Adding the viewbox fixed me too.
from cairocffi.
Related Issues (20)
- Symbol not found in flat namespace '_ffi_prep_closure' HOT 3
- All tests fail with ModuleNotFoundError: No module named 'cairocffi._generated.ffi' HOT 2
- Minor fix for m1 Macs with CFFI issues
- No module named 'cairocffi._generated' HOT 6
- libffi errors after cffi update to 1.15.1 HOT 5
- test_xcb tests are considered too unstable HOT 5
- Test failures with cairo 1.17.6 HOT 4
- Support for Offline Builds HOT 4
- The "changelog" link in the README displays only versions, not changes HOT 2
- please include LICENSE in the PyPI tarball
- Can't install new release HOT 7
- Cairocffi not building with XCB support in 1.5.0 HOT 15
- 1.5.0 is no longer compatible with Msys2 Mingw HOT 6
- Fixing cairocffi[xcb] installation issues once for all HOT 24
- Offline installation is not possible to due build script HOT 2
- Hack to import constants.py breaks installation via PyInstaller HOT 5
- API compatibility with Pycairo: TextExtents
- API compatibility with Pycairo: Composite Operators
- Basic Usage example doesn't work on 1.6.0 and 1.6.1 HOT 2
- Documentation links to 32-bit GTK version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cairocffi.