Zulko / gizeh

Simple Vector Graphics for Python
Other
702 stars 70 forks source link

Can't run my code #12

Closed ukn-ubi closed 9 years ago

ukn-ubi commented 9 years ago

When I ran my code I got:

Traceback (most recent call last): File "C:/Users/Simon/PycharmProjects/Ani/Main.py", line 6, in import gizeh File "C:\Anaconda3\lib\site-packages\gizehinit.py", line 5, in from .gizeh import File "C:\Anaconda3\lib\site-packages\gizeh\gizeh.py", line 4, in import cairocffi as cairo File "C:\Anaconda3\lib\site-packages\cairocffiinit.py", line 41, in cairo = dlopen(ffi, CAIRO_NAMES) File "C:\Anaconda3\lib\site-packages\cairocffiinit.py", line 34, in dlopen return ffi.dlopen(names[0]) # pragma: no cover File "C:\Anaconda3\lib\site-packages\cffi\api.py", line 118, in dlopen lib, function_cache = _make_ffi_library(self, name, flags) File "C:\Anaconda3\lib\site-packages\cffi\api.py", line 411, in _make_ffi_library backendlib = _load_backend_lib(backend, libname, flags) File "C:\Anaconda3\lib\site-packages\cffi\api.py", line 400, in _load_backend_lib return backend.load_library(name, flags) OSError: cannot load library libcairo.so.2: error 0x7e

I was trying to run one of the examples:

import gizeh import moviepy.editor as mpy

W,H = 128,128 # width, height, in pixels duration = 2 # duration of the clip, in seconds

def makeframe(t): surface = gizeh.Surface(W,H) radius = W(1+ (t_(duration-t))**2 )/6 circle = gizeh.circle(radius, xy = (W/2,H/2), fill=(1,0,0)) circle.draw(surface) return surface.get_npimage()

clip = mpy.VideoClip(make_frame, duration=duration) clip.write_gif("circle.gif",fps=15, opt="OptimizePlus", fuzz=10)

Zulko commented 9 years ago

Have you first installed Cairo on your computer ? If not, install Cairo and tell me if this works (also, remove opt="OptimizePlus", fuzz=10 in the last line, it's not necessary anymore)

ukn-ubi commented 9 years ago

I have Cario installed and I have added it to my path.

Zulko commented 9 years ago

Strange. The best I can do now is to redirect you to this issue of cairocffi. Maybe if you say you get the error and give your Windows and Python versions they will be able to help you. Another possibility would be that your cairo version is outdated (?). In last resort, it seems from what I googled that finding the libcairo.so.2 file on the web and downloading it in your current directory could solve the problem.

ukn-ubi commented 9 years ago

By now it doesn't matter that much to me. Thanks anyway! - Xi