Giter Site home page Giter Site logo

Comments (12)

SimonSapin avatar SimonSapin commented on May 11, 2024

@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.

tooh avatar tooh commented on May 11, 2024

Can write file

==> ls *.png
test.png

from cairocffi.

SimonSapin avatar SimonSapin commented on May 11, 2024

Ok… let’s try a smaller test case:

import cairocffi
cairocffi.ImageSurface(cairocffi.FORMAT_ARGB32, 100, 100).write_to_png('test.png')

from cairocffi.

tooh avatar tooh commented on May 11, 2024

file test.png written

from cairocffi.

SimonSapin avatar SimonSapin commented on May 11, 2024

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.

liZe avatar liZe commented on May 11, 2024

No idea. Could you try to use an absolute path? (something like cairosvg test.svg -o /tmp/test.png)

from cairocffi.

tooh avatar tooh commented on May 11, 2024

Same result

from cairocffi.

mkv123 avatar mkv123 commented on May 11, 2024

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.

SimonSapin avatar SimonSapin commented on May 11, 2024

@mkv123 Is this with CairoSVG?

from cairocffi.

mkv123 avatar mkv123 commented on May 11, 2024

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.

liZe avatar liZe commented on May 11, 2024

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.

kogcyc avatar kogcyc commented on May 11, 2024

Thanks, mkv123!

Adding the viewbox fixed me too.

from cairocffi.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.