Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
using pyinstaller
#1
Heart 
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
Reply
#2
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
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply
#3
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
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020