Python Forum

Full Version: using pyinstaller
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello forum,

I want to create an executable of my python code. But I´m running into an error when I run the executable.

My file "test.py" has the following content:

import numpy as np
from moviepy.editor import VideoFileClip, concatenate_videoclips

print("hello world")
When I run: "python test.py" in my console it generates an output and put "hello world" on my console. So far so great!

When I run the command: "pyinstaller --onefile test.py" it generates an executable in my dist directory. However, when I run the executable I get the following error:

AttributeError: module 'moviepy.audio.fx.all' has no attribute 'audio_fadein'
[10316] Failed to execute script testinstaller

Why I cannot run the executable while the code runs fine going through the python compiler?

I use:

Python 3.8.3
Pyinstaller 4.0 (I have tried 4.1 from github as well, but I get the same results)

Thanks for helping me out in advance.

Greetings,

Irwin
can you run the exe from cmd/terminal and post the full traceback you get? Also - which version of moviepy?

I guess the problem is with some hidden import and you need to tell pyinstaller to include it with --hidden-import option
https://pyinstaller.readthedocs.io/en/st...en-imports
I use MoviePy 1.0.3

Anyway, I managed to add moviepy in my .spec file using the following line:

a.datas += Tree("C:\\Programs\\miniconda\\Lib\\site-packages\\moviepy", prefix='moviepy')

Now I don't get the moviepy error anymore, however I have another module that cannot be loaded right now. it's called decorator.

When I try to add it in my .spec file I still get the same error. Is the syntax somehow wrong? I used:

a.datas += Tree("C:\\Programs\\miniconda\\Lib\\site-packages\\decorator-4.4.2.dist-info", prefix='decorator')

Thanks again in advance!

Irwin