Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AttributeError: 'module' object has no attribute 'audio_fadein'

I have used cx_freeze to build a python project into a single folder with an .exe and it's dependencies, but when I run the .exe I get the error:

AttributeError: module 'moviepy.audio.fx.all' has no attribute 'audio_fadein'

AttributeError

I have read the docs for MoviePy but cannot find out why this is happening. My Python program runs perfectly from within the IDE (PyCharm) but after compiling, I am getting the MoviePy error. I have used the recommended from moviepy.editor import *

I don't actually use the audio_fadein directly in my script, so it must be being called by MoviePy when I show my video. Here is the code:

def cherrybyte():
    pygame.display.set_caption('©2017 CherryByte™ Software')
    pygame.mouse.set_visible(False)
    logo = VideoFileClip('CherryByte Logo.mp4')
    logo.preview()
    pygame.mouse.set_visible(True)

EDIT: I have now also tried changing the import statement to from moviepy.editor import VideoFileClip but with exactly the same error.

like image 416
Jayce Avatar asked Jun 18 '17 12:06

Jayce


People also ask

How do I fix Python module has no attribute?

To solve the Python "AttributeError: module has no attribute", make sure you haven't named your local modules with names of remote modules, e.g. datetime.py or requests.py and remove any circular dependencies in import statements.

What does it mean by object has no attribute?

It's simply because there is no attribute with the name you called, for that Object. This means that you got the error when the "module" does not contain the method you are calling.


1 Answers

I had same error while I was using the pyinstaller to build the .exe file. However, I changed the import statement to from moviepy.video.io.VideoFileClip import VideoFileClip and it worked.

like image 83
林斯賢 Avatar answered Sep 22 '22 16:09

林斯賢