You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import numpy as np
import mayavi.mlab as mlab
import moviepy.editor
from moviepy.editor import VideoClip
duration= 2 # duration of the animation in seconds (it will loop)
# MAKE A FIGURE WITH MAYAVI
fig_myv = mlab.figure(size=(220,220), bgcolor=(1,1,1))
X, Y = np.linspace(-2,2,200), np.linspace(-2,2,200)
XX, YY = np.meshgrid(X,Y)
ZZ = lambda d: np.sinc(XX**2+YY**2)+np.sin(XX+d)
# ANIMATE THE FIGURE WITH MOVIEPY, WRITE AN ANIMATED GIF
def make_frame(t):
mlab.clf() # clear the figure (to reset the colors)
mlab.mesh(YY,XX,ZZ(2**np.pit/duration), figure=fig_myv)
return mlab.screenshot(antialiased=True)
animation = VideoClip(make_frame, duration=duration)
animation.write_gif("sinc.gif", fps=20)
I am able to run the above commands in the terminal without any issue but when I am trying to run it using the script (python gif.py) I am getting a segmentation fault error. I am using the same version of python on my system for both the script and for running commands on the terminal. The following is the error thread using the fault handler:
Current thread 0x00007f2adf7cf700 (most recent call first):
File "/home/multismart/.local/lib/python3.5/site-packages/tvtk/tvtk_base.py", line 594 in _wrap_call
File "tvtk_classes/open_gl_render_window.py", line 117 in get_pixel_data
File "/home/multismart/.local/lib/python3.5/site-packages/mayavi/tools/figure.py", line 340 in screenshot
File "mayavi_gif.py", line 21 in make_frame
File "/usr/local/lib/python3.5/dist-packages/moviepy/Clip.py", line 93 in get_frame
File "/usr/local/lib/python3.5/dist-packages/moviepy/decorators.py", line 89 in wrapper
File "<decorator-gen-18>", line 2 in get_frame
File "/usr/local/lib/python3.5/dist-packages/moviepy/video/VideoClip.py", line 86 in init
File "mayavi_gif.py", line 22 in <module>
Segmentation fault (core dumped)
Can someone point out what I am doing wrong in running the script compare to running the same commands on the terminal?
The text was updated successfully, but these errors were encountered:
Thank you for trying. I have checked, separately, mayavi and moviepy package and the examples are working in both cases (terminal and running script). Do you have any suggestions or guess "Why the behavior is different in the shell(works in the shell) as opposed to running the python script(segmentation fault error) in the terminal for the above code? "
The above problem is related to mayavi rather than moviepy. I found that it is related to error in mlab.screenshot() value error: enthought/mayavi#702
Adding the following lines in the above code solved the problem
Hi everyone, I have installed moviepy, recently, and was trying to run the example in the following blog to make a gif using mayavi and moviepy packages:
http://zulko.github.io/blog/2014/11/29/data-animations-with-python-and-moviepy/
Code:
I am able to run the above commands in the terminal without any issue but when I am trying to run it using the script (python gif.py) I am getting a segmentation fault error. I am using the same version of python on my system for both the script and for running commands on the terminal. The following is the error thread using the fault handler:
Can someone point out what I am doing wrong in running the script compare to running the same commands on the terminal?
The text was updated successfully, but these errors were encountered: