I've made the YouTube Dowbloader App. Everything is working properly (run in PyCharm), but when I try to make it into an executable with pyinstaller, it does not work.
This is the link to the repo:
Command for making exe file:pyinstaller project.spec
project.spec file:
# project.spec# -*- mode: python ; coding: utf-8 -*-block_cipher = Nonea = Analysis( ['gui.py'], pathex=['.'], binaries=[], datas=[('static_files/*', 'static_files')], hiddenimports=[], hookspath=[], runtime_hooks=[], excludes=[], win_no_prefer_redirects=False, win_private_assemblies=False, cipher=block_cipher,)pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)exe = EXE( pyz, a.scripts, [], exclude_binaries=True, name='YouTube Downloader', debug=False, bootloader_ignore_signals=False, strip=False, upx=True, upx_exclude=[], runtime_tmpdir=None, console=False, icon='static_files/logo.ico')coll = COLLECT( exe, a.binaries, a.zipfiles, a.datas, strip=False, upx=True, upx_exclude=[], name='YouTube Downloader')app = BUNDLE( coll, name='YouTube Downloader', icon='static_files/logo.ico', bundle_identifier=None)The file structure:
project/├── backend.py├── gui.py├── temp_mp3 # temporary mp3 for Audio player├── static_files/│├── icon.ico│├── image1.png│├── image2.png│└── setup.json # setup.json file└── project.specSearch block diagram:Search block diagram
After searching and fetching the YouTube URL, the app downloads an MP3 file (in temp_mp3) for the audio player section.
And here is the difference between .exe and the .py, when I run .exe the APP downloads the audio segment from the URL in .webm format and stops there. Even if the format is different, it should be converted to MP3 (in PyCharm does).
Find possible problem with moviepy/ffmpeg.exe (library for converting files).
project.spec
a = Analysis( ['gui.py'], pathex=['.'], binaries=[('C:\\path\\to\\ffmpeg\\bin\\ffmpeg.exe', 'ffmpeg')], datas=[('static_files/*', 'static_files')],Added binaries => path to ffmpeg.exe , but it still doesn't work.