flet: `flet build` gives "OSError: [WinError 193] %1 is not a valid Win32 application" for some users
Description
Code example to reproduce the issue:
from flet import *
def main(page: Page):
page.window_width = 428
search_bar = SearchBar(
view_elevation=2,
view_bgcolor='gray',
bar_overlay_color='white',
bar_hint_text='Search...',
bar_leading=IconButton(icon='search')
)
page.add(
Column([
search_bar
])
)
app(main)
Describe the results you received:
Describe the results you expected: Expect my code to be built to an APK file after going through the process described in the documentation
Additional information you deem important (e.g. issue happens only occasionally):
Flet version (pip show flet
):
Version: 0.18.0
Generating app icons...Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\HomePC\AppData\Roaming\Python\Python312\Scripts\flet.exe\__main__.py", line 7, in <module>
File "C:\Users\HomePC\AppData\Roaming\Python\Python312\site-packages\flet\cli\cli.py", line 83, in main
args.handler(args)
File "C:\Users\HomePC\AppData\Roaming\Python\Python312\site-packages\flet\cli\commands\build.py", line 515, in handle
icons_result = self.run(
^^^^^^^^^
File "C:\Users\HomePC\AppData\Roaming\Python\Python312\site-packages\flet\cli\commands\build.py", line 701, in run
r = subprocess.run(
^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\subprocess.py", line 548, in run
with Popen(*popenargs, **kwargs) as process:
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Program Files\Python312\Lib\subprocess.py", line 1026, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "C:\Program Files\Python312\Lib\subprocess.py", line 1538, in _execute_child
hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: [WinError 193] %1 is not a valid Win32 application
Operating system: Windows 11
Additional environment details:
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 20 (8 by maintainers)
Commits related to this issue
- Fix "OSError: [WinError 193] %1 is not a valid Win32 application" error on Windows Fix #2318 — committed to flet-dev/flet by FeodorFitsner 6 months ago
- `flet build` improvements (#2404) * `flet build -vv` should run `pip install` with verbose output Close #2351 * `flet build` should raise an error when trying to package an app with native modu... — committed to Skquark/flet by FeodorFitsner 6 months ago
OK, another challenge 😃 Whoever has
flutter.file
files in Flutterbin
folder can you run this command please:I encoutnered the same issue. This is caused by how the flutter and dart SDK are named. I fixed it by renaming the
dart
andflutter
batch file in thebin
folder in flutter sdk to something else.Navigate to the directory where flutter is downloaded, for me it was
D:\flutter
Then, navigate into the bin folder where you’ll find two batch files,dart.bat
andflutter.bat
along withdart.file
andflutter.file
. Rename these two.file
into something else, saydart_file
andflutter_file
and the error should be resolved.