How to build in some .exe file? #3787
Replies: 11 comments
-
I am in this exact same phase. Use a helper script to copy the ffmpeg to flet directory |
Beta Was this translation helpful? Give feedback.
-
Hi ,Could you please describe it in more detail? I put ffmpeg.exe in flet directory already. But when I bulit with "flet build windows" and then run my app . It shows that can’t find ffmpeg.exe in "C://User/xxx/AppData/Local/XX" which is flutter build temp dir. |
Beta Was this translation helpful? Give feedback.
-
I found the old build command “flet pack xxx.py ” is useful for me ==! |
Beta Was this translation helpful? Give feedback.
-
There is another way i think, i haven't tested it. But you can put your exe in |
Beta Was this translation helpful? Give feedback.
-
Thanks for you reply, I put the fmmpeg.exe in assets/ dir ,but I always get the temp path of building exe path (not real path with exe) in my app ,which is built use "flet build windows" |
Beta Was this translation helpful? Give feedback.
-
so bascially you have to CD into the assets directory. Something like this might be doable by doing from pathlib import Path
import os
BASE_DIR = Path(__file__).resolve().parent
ASSETS_DIR = os.path.join(BASE_DIR, 'assets')
FFMPEG_BINARY = os.path.join(ASSETS_DIR, 'ffmpeg.exe') |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
However it did work with my local build. could you tree your build directory and your project directory? |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
Okay, i will try to setup a demo project, where i will try to debug the issue. |
Beta Was this translation helpful? Give feedback.
-
Here’s a workaround I found and would like to share: class DirectoryUtil:
exe_name = "yourexefile.exe"
base_dir = None
@classmethod
def init_base_directory(cls):
# when running serious-python, sys.argv is empty([])
if not sys.argv[0]:
for pid in psutil.pids():
proc = psutil.Process(pid)
if proc.name() == cls.exe_name:
cls.base_dir = os.path.dirname(proc.exe())
else:
cls.base_dir = os.getcwd() |
Beta Was this translation helpful? Give feedback.
-
Duplicate Check
Describe the requested feature
eg, I want to build ffmpeg to my windows app . What should I do.
Suggest a solution
No response
Screenshots
No response
Additional details
No response
Beta Was this translation helpful? Give feedback.
All reactions