Ask Your Question

Revision history [back]

Ok, I couldn't resist looking into this more. I'm using sage 4.7, and the code I posted above works for me even without ticket 11461 applied. Strangely, I get the error "invalid load key, 'x'" only when I return the graphics object. Moreover, I get that same error (with x) even when I change the variable name to t. So I think this is a bug. I wonder if it has something to do with passing the bare graphics object between separate sage processes. There seems to be no error if I return something containing the graphics object:

FRAMES = 10

@parallel
def frame(i):
    t = var('t')
    g = plot(sin(i*t), (t,0, pi))
    return (g,)

frame_iter = frame(range(2,FRAMES+1))
P = list(frame_iter)
Q = [p[1][0] for p in P]
animate(Q)
Animation with 9 frames

p.s. For longer animations, I really like ffmpeg. An option to use it with the animate command should be coming in sage 4.7.1 (see ticket 11170 if you can't wait).


UPDATE: Searching for "invalid load key" with search_src yields only one use in the entire Sage library, in a doctest for load in structure/sage_object.pyx.