Bug Description
When running flet build windows -v on Windows, the build fails with a "command not found" error because the Dart executable path has .exe extension added twice, resulting in dart.EXE.exe.
Environment
- OS: Windows 11 (Version 10.0.26200.7628)
- Flet version: 0.80.4
- Flet-CLI version: 0.80.4
- Flutter version: 3.38.8 (Channel stable)
- Python version: 3.10+
Root Cause
In flet_cli/commands/flutter_base.py, the find_flutter_batch() method uses shutil.which() to find the Dart executable on Windows. This function returns the full path with .EXE extension (uppercase).
Steps to Reproduce
- Install Flet on Windows 11
- Run
flet build windows -v
- Observe the error during native assets compilation
Proposed Fix
In flet_cli/commands/flutter_base.py, modify the find_flutter_batch() method to strip the .exe extension on Windows:
def find_flutter_batch(self, exe_filename: str):
assert self.required_flutter_version
install_dir = get_flutter_dir(str(self.required_flutter_version))
ext = ".bat" if is_windows() else ""
batch_path = os.path.join(install_dir, "bin", f"{exe_filename}{ext}")
if os.path.exists(batch_path):
return batch_path
batch_path = shutil.which(exe_filename)
if not batch_path:
return None
if is_windows() and batch_path.endswith(".file"):
return batch_path.replace(".file", ".bat")
# Remove .exe/.EXE extension on Windows if present (Flutter adds it back)
if is_windows() and batch_path.lower().endswith(".exe"):
return batch_path[:-4]
return batch_path
Bug Description
When running
flet build windows -von Windows, the build fails with a "command not found" error because the Dart executable path has.exeextension added twice, resulting indart.EXE.exe.Environment
Root Cause
In
flet_cli/commands/flutter_base.py, thefind_flutter_batch()method usesshutil.which()to find the Dart executable on Windows. This function returns the full path with.EXEextension (uppercase).Steps to Reproduce
flet build windows -vProposed Fix
In
flet_cli/commands/flutter_base.py, modify thefind_flutter_batch()method to strip the.exeextension on Windows: