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'
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.
For everyone that has the same issue i solved it by modifying the selected init file shown in the picture below:
Inside it there is a piece of code that import every function inside the fx folder:
__all__ = [name for _, name, _ in pkgutil.iter_modules(
fx.__path__) if name != "all"]
for name in __all__:
exec("from ..%s import %s" % (name, name))
Comment this block and import manually every function needed, like so:
from moviepy.video.fx.accel_decel import accel_decel
from moviepy.video.fx.blackwhite import blackwhite
from moviepy.video.fx.blink import blink
from moviepy.video.fx.crop import crop
from moviepy.video.fx.even_size import even_size
from moviepy.video.fx.fadein import fadein
from moviepy.video.fx.fadeout import fadeout
from moviepy.video.fx.mirror_x import mirror_x
from moviepy.video.fx.mirror_y import mirror_y
from moviepy.video.fx.resize import resize
#etc.
Do the same with the init placed in moviepy.audio.fx.all