“The End” effect example scripts get fault -- TypeError: 'NoneType' object is not subscriptable
See original GitHub issueI run the example scripts “The End” effect after complete the installation,the code is:
from moviepy.editor import *
from moviepy.video.tools.drawing import circle
clip = VideoFileClip("myvideo.mp4", audio=False).\
subclip(26,31).\
add_mask()
w,h = clip.size
# The mask is a circle with vanishing radius r(t) = 800-200*t
clip.mask.get_frame = lambda t: circle(screensize=(clip.w,clip.h),
center=(clip.w/2,clip.h/4),
radius=max(0,int(800-200*t)),
col1=1, col2=0, blur=4)
the_end = TextClip("The End", font="Amiri-bold", color="white",
fontsize=70).set_duration(clip.duration)
final = CompositeVideoClip([the_end.set_pos('center'),clip],
size =clip.size)
final.write_videofile("theEnd.mp4")
Expected Behavior
Return correct
Actual Behavior
Traceback (most recent call last):
File "theend.py", line 34, in <module>
video.write_videofile("theEnd.mp4")
File "<decorator-gen-61>", line 2, in write_videofile
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/decorators.py", line 56, in requires_duration
return f(clip, *a, **k)
File "<decorator-gen-60>", line 2, in write_videofile
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/decorators.py", line 135, in use_clip_fps_by_default
return f(clip, *new_a, **new_kw)
File "<decorator-gen-59>", line 2, in write_videofile
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/decorators.py", line 24, in convert_masks_to_RGB
return f(clip, *a, **k)
File "<decorator-gen-58>", line 2, in write_videofile
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 350, in write_videofile
logger=logger,
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/video/io/ffmpeg_writer.py", line 245, in ffmpeg_write_video
logger=logger, with_times=True, fps=fps, dtype="uint8"
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/Clip.py", line 473, in iter_frames
frame = self.get_frame(t)
File "<decorator-gen-11>", line 2, in get_frame
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/decorators.py", line 89, in wrapper
return f(*new_a, **new_kw)
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/Clip.py", line 98, in get_frame
return self.make_frame(t)
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/video/compositing/CompositeVideoClip.py", line 123, in make_frame
f = c.blit_on(f, t)
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/video/VideoClip.py", line 599, in blit_on
mask = self.mask.get_frame(ct) if self.mask else None
File "movie.py", line 15, in <lambda>
col1=1, col2=0,blur=4,)
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/video/tools/drawing.py", line 280, in circle
offset=offset,
File "/home/pandahub/.local/lib/python3.6/site-packages/moviepy/video/tools/drawing.py", line 146, in color_gradient
vector = np.array(vector[::-1])
TypeError: 'NoneType' object is not subscriptable
Steps to Reproduce the Problem
- install the moviepy ( I have tried both 1.0.3 & v2.0.0.dev1 version, and both are fault) pip install moviepy
- install the ffmpeg, or it will be fault with “ffmpeg not installed” when run the script sudo apt update sudo add-apt-repository ppa:jonathonf/ffmpeg-4 sudo apt install ffmpeg
- update the /etc/ImageMagick-6/policy.xml, or it will be fault with “ImageMagick not installed” when run the script <policy domain="path" rights="none" pattern="@*" /> changed to
- finally I run the script, and it get thta error message: TypeError: ‘NoneType’ object is not subscriptable python theend.py
Specifications
- Python Version: python3.6
- Moviepy Version: both 1.0.3 & v2.0.0.dev1
- Platform Name: ubuntu 18.04
- Platform Version: 18.04
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:11 (1 by maintainers)
Top Results From Across the Web
'NoneType' object is not subscriptable" : r/learnpython - Reddit
and at the end I try to replace those None by objects. And it's there where I get the error. If I debug...
Read more >TypeError: 'NoneType' object is not subscriptable" for a ...
Whatever you are returning at the end of the create_world() function has to be a dictionary. I ran into this problem often, in...
Read more >Recently Active 'nonetype' Questions - Stack Overflow
I'm getting the unsupported format string error message from the ... that stores 3 players and their scores in a list and then...
Read more >Light Fader by Transition Time - #15 by Coolie1101 - Scripts
Error executing script: 'int' object is not subscriptable Traceback (most ... that kicks in when one of the entities reaches the end state....
Read more >86791 – LibreLogo Typed Command Execution Fails, Error When ...
Pressing enter after typing commands into the input bar has no effect. 2. ... If I click on the "Go to beginning" button,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@tburrows13 @0xe590b4 I dont think that is true, the error is in the lines above it, and it still exists. When color_gradient is invoked from circle, neither vector or p2 is passed. So the if does not satisfy, and the else fails, as shown in the stacktrace.
NO. I’m using from pip. so that’s why occured maybe. Actually many example is not working with the pip version.