Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pyinstaller and moviepy, ffmpeg works from terminal but not from finder

I am packaging python using pyinstaller 2.1 on OSX Mavericks. I have done this successfully in the past, but this is my first package that uses moviepy and ffmpeg. I use the following import:

from moviepy.video.io import ffmpeg_reader

Without this line in the code, everything works fine and I can launch my final package from its icon in finder. With the moviepy import, it will work if I launch from the terminal like this:

open ./myapp.app

but it will not open if I click on the icon from finder (opens quickly and crashes). I am assuming this has something to do with paths or environment variables that are set in terminal, but are not transferred to my packaged app. I have tried various hidden imports in pyinstaller for moviepy and its dependencies, but nothing seems to work. --debug mode hasn't provided much info to track it down. Any other ideas?

Thanks!

like image 321
Todd Avatar asked Nov 10 '22 23:11

Todd


1 Answers

There are a few problems with moviepy and pyinstaller.

First, try writing the error to a text file

try:
    from moviepy.video.io import ffmpeg_reader
except Exception as e:
    with open('/absolute/path/to/error.txt',mode="w+") as f:
        f.write(str(e))

1) You might need to modify these two files to remove the "exec" import statements

moviepy/audio/fx/all/__init__.py, moviepy/video/fx/all/__init__.py

see here: https://github.com/pratikone/videoVenom/blob/master/moviepy/audio/fx/all/__init__.py https://github.com/pratikone/videoVenom/blob/master/moviepy/video/fx/all/__init__.py

2) You might need to have this statement imageio.plugins.ffmpeg.download(), so that ffmpeg is downloaded if not found.

like image 62
jmtennant Avatar answered Nov 14 '22 23:11

jmtennant