Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'NoneType' object has no attribute 'get_frame' #1025

Closed
arianaa30 opened this issue Oct 1, 2019 · 4 comments
Closed

AttributeError: 'NoneType' object has no attribute 'get_frame' #1025

arianaa30 opened this issue Oct 1, 2019 · 4 comments
Labels
bug Issues that report (apparent) bugs.

Comments

@arianaa30
Copy link

arianaa30 commented Oct 1, 2019

MoviePy while effective, sometimes it's very unpredictable and unreliable. Once it runs, next time it fails. I was just running a concat on subvideos, now the same script is failing. I don't recall changing anything. Am I doing anything wrong?!

    for i in range(parts):
        cl = VideoFileClip(bestFilename[i])
        start = 0
        end = float(length / parts)
        s = cl.subclip(start, end);
        sub.append(s)
        cl.reader.close()
    final = concatenate([sub[0], sub[1].crossfadein(.5), sub[2].crossfadein(.5), sub[3].crossfadein(.5)], padding=-1, method="compose")
    final.write_videofile(output+filename+".mp4",audio=False)
    self.make_frame = lambda t: self.reader.get_frame(t)
AttributeError: 'NoneType' object has no attribute 'get_frame'

@tburrows13 tburrows13 added the bug Issues that report (apparent) bugs. label Oct 2, 2019
@tburrows13
Copy link
Collaborator

Hi!

Whenever you are reporting bugs and crashes, you need to give the entire error traceback, not just the last 2 lines. I have very little way of knowing where in moviepy the error happened from what you've given me.

However, I think if you remove the cl.reader.close() line it will work. Look at https://github.com/Zulko/moviepy/blob/master/moviepy/video/io/VideoFileClip.py#L123 for what happens when you call close on the VideoFileClip: it sets self.reader to None, which would explain why in the error it is complaining that self.reader has NoneType (ie is set to None).

Sidenote: concatenate() is depracated; use concatenate_videoclips() instead. https://github.com/Zulko/moviepy/blob/master/moviepy/video/compositing/concatenate.py#L15 vs https://github.com/Zulko/moviepy/blob/master/moviepy/video/compositing/concatenate.py#L124

@arianaa30
Copy link
Author

Thanks. Yeah I thought it's a famous error so didn't bother including the whole trace.
I'm posting another similar error

@tburrows13
Copy link
Collaborator

Don't worry, I thought the exact same thing when I started programming/using Github 3 years ago. However, even if it was a famous/known error we can only guess that it is the same problem that is causing it without the traceback.

@tburrows13
Copy link
Collaborator

This should be fixed in #1185, MoviePy v1.0.3. Feel free to create a new issue if you are still experiencing this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issues that report (apparent) bugs.
Development

Successfully merging a pull request may close this issue.

2 participants