flet build fails since version 0.23.0
Duplicate Check
- [X] I have searched the opened issues and there are no duplicates
Describe the bug
I have a CI/CD build pipeline (which automatically uses the newest flet version for dev builds) and since version 0.23.0 was released the pipeline stopped working. When the pipeline calls flet build windows the following error occurs:
2024-06-20T00:15:25.1011547Z [00:15:25] Flutter bootstrap directory:
2024-06-20T00:15:25.1012321Z C:\Users\VSSADM~1\AppData\Local\Temp\flet_flutter_build_inECDt8rB4
2024-06-20T00:15:25.1036317Z Additional Flutter dependencies:
2024-06-20T00:15:25.1036814Z {}
2024-06-20T00:15:27.3498979Z [00:15:27] Created Flutter bootstrap project from
2024-06-20T00:15:27.3506365Z gh:flet-dev/flet-build-template with ref 0.23.0[00:15:27] Created Flutter bootstrap project from
2024-06-20T00:15:27.3508356Z Traceback (most recent call last):
2024-06-20T00:15:27.3509164Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\flet\cli\commands\build.py", line 462, in handle
2024-06-20T00:15:27.3517242Z console.log(
2024-06-20T00:15:27.3519586Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 1941, in log
2024-06-20T00:15:27.3526006Z with self:
2024-06-20T00:15:27.3526692Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 865, in __exit__
2024-06-20T00:15:27.3528840Z self._exit_buffer()
2024-06-20T00:15:27.3529418Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 823, in _exit_buffer
2024-06-20T00:15:27.3532403Z self._check_buffer()
2024-06-20T00:15:27.3532975Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 2027, in _check_buffer
2024-06-20T00:15:27.3538843Z legacy_windows_render(buffer, LegacyWindowsTerm(self.file))
2024-06-20T00:15:27.3539543Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\_windows_renderer.py", line 17, in legacy_windows_render
2024-06-20T00:15:27.3540074Z term.write_styled(text, style)
2024-06-20T00:15:27.3540742Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\_win32_console.py", line 442, in write_styled
2024-06-20T00:15:27.3543730Z self.write_text(text)
2024-06-20T00:15:27.3544277Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\_win32_console.py", line 403, in write_text
2024-06-20T00:15:27.3546194Z self.write(text)
2024-06-20T00:15:27.3546527Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\encodings\cp1252.py", line 19, in encode
2024-06-20T00:15:27.3948005Z return codecs.charmap_encode(input,self.errors,encoding_table)[0]
2024-06-20T00:15:27.3949612Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-20T00:15:27.3954099Z UnicodeEncodeError: 'charmap' codec can't encode character '\u2705' in position 1: character maps to <undefined>
2024-06-20T00:15:27.3954285Z
2024-06-20T00:15:27.3954442Z During handling of the above exception, another exception occurred:
2024-06-20T00:15:27.3954565Z
2024-06-20T00:15:27.3954679Z Traceback (most recent call last):
2024-06-20T00:15:27.3954835Z File "<frozen runpy>", line 198, in _run_module_as_main
2024-06-20T00:15:27.3955011Z File "<frozen runpy>", line 88, in _run_code
2024-06-20T00:15:27.3955326Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Scripts\flet.exe\__main__.py", line 7, in <module>
2024-06-20T00:15:27.3955834Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\flet\cli\cli.py", line 88, in main
2024-06-20T00:15:27.3957998Z args.handler(args)
2024-06-20T00:15:27.3958755Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\flet\cli\commands\build.py", line 335, in handle
2024-06-20T00:15:27.3960986Z with console.status(
2024-06-20T00:15:27.3963764Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\status.py", line 106, in __exit__
2024-06-20T00:15:27.3964567Z self.stop()
2024-06-20T00:15:27.3965108Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\status.py", line 91, in stop
2024-06-20T00:15:27.3965470Z self._live.stop()
2024-06-20T00:15:27.3967120Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\live.py", line 147, in stop
2024-06-20T00:15:27.3967951Z with self.console:
2024-06-20T00:15:27.3968437Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 865, in __exit__
2024-06-20T00:15:27.3971578Z self._exit_buffer()
2024-06-20T00:15:27.3972183Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 823, in _exit_buffer
2024-06-20T00:15:27.3974883Z self._check_buffer()
2024-06-20T00:15:27.3975439Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\console.py", line 2027, in _check_buffer
2024-06-20T00:15:27.3981967Z legacy_windows_render(buffer, LegacyWindowsTerm(self.file))
2024-06-20T00:15:27.3982698Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\_windows_renderer.py", line 17, in legacy_windows_render
2024-06-20T00:15:27.3983129Z term.write_styled(text, style)
2024-06-20T00:15:27.3983684Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\_win32_console.py", line 442, in write_styled
2024-06-20T00:15:27.3986235Z self.write_text(text)
2024-06-20T00:15:27.3986823Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\site-packages\rich\_win32_console.py", line 403, in write_text
2024-06-20T00:15:27.3989101Z self.write(text)
2024-06-20T00:15:27.3989467Z File "C:\hostedtoolcache\windows\Python\3.11.9\x64\Lib\encodings\cp1252.py", line 19, in encode
2024-06-20T00:15:27.3990770Z return codecs.charmap_encode(input,self.errors,encoding_table)[0]
2024-06-20T00:15:27.3991408Z ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-20T00:15:27.3991898Z UnicodeEncodeError: 'charmap' codec can't encode character '\u2705' in position 1: character maps to <undefined>
The build finishes successfully with earlier flet versions. EDIT Info: also tested bugfix version 0.23.1. It does not resolve this error.
Code
No response
To reproduce
Azure agents pipeline with the following agent configuration:
Agent name: 'Hosted Agent'
Agent machine name: 'fv-az621-36'
Current agent version: '3.240.1'
Operating System
Microsoft Windows Server 2022
10.0.20348
Datacenter
Runner Image
Image: windows-2022
Version: 20240610.1.0
Included Software: https://github.com/actions/runner-images/blob/win22/20240610.1/images/windows/Windows2022-Readme.md
Image Release: https://github.com/actions/runner-images/releases/tag/win22%2F20240610.1
Pipeline:
stages:
- stage: Build_Stage
displayName: 'Build'
jobs:
# Windows Build
- job: 'Windows'
displayName: 'Windows Application'
pool:
vmImage: windows-latest
steps:
- task: FlutterInstall@0
inputs:
mode: 'auto'
channel: 'stable'
version: 'latest'
displayName: 'Install Flutter SDK'
- task: UsePythonVersion@0
inputs:
versionSpec: '3.11'
addToPath: true
architecture: 'x64'
displayName: 'Select Python 3.11'
- script: |
python -m pip install --upgrade pip
python -m pip install flet
flet build -v --org $(ORG_NAME) --company $(COMPANY_NAME) --build-number $(Build.BuildId) --build-version $(MAJOR).$(MINOR).$(BUGFIX) windows
displayName: 'Build Application'
Flutter version == 3.22.2 Dart version == 3.4.3
While executing flet build windows the above-described error occurs.
When changing the line python -m pip install flet to python -m pip install flet==0.22.* it finishes the build successfully.
Expected behavior
No response
Screenshots
No response
Operating System
Windows
Operating system details
Microsoft Windows Server 2022 10.0.20348
Flet version
0.23.0
Regression
Yes, it used to work in a previous Flet version (please specify the version in additional details)
Suggestions
No response
Additional details
No response
I also ran into this issue for a simple app, while looking into this error that I'm also having #2103.
mian.py
import flet as ft
def main(page: ft.Page):
page.add(ft.ListView(controls=[
ft.Text(f"{x}. Hello World!") for x in range(100)
], expand=True, spacing=10))
ft.app(target=main, view=ft.AppView.FLET_APP)
requirements.txt
flet
When running flet build windows -vv I get the following output:
[07:34:33] Flutter executable: C:\Users\<user>\AppData\Local\flutter\bin\flutter.BAT
Dart executable: C:\code\source\flutter_windows_1.22.6-stable\flutter\bin\cache\dart-sdk\bin\dart.EXE
Flutter bootstrap directory: C:\Users\<user>\AppData\Local\Temp\flet_flutter_build_tNgMazW40C
Additional Flutter dependencies:
{}
[07:34:42] Created Flutter bootstrap project from gh:flet-dev/flet-build-template with ref 0.23.2 ✅
Customized app icons and splash images ✅
Run subprocess: ['C:\\code\\source\\flutter_windows_1.22.6-stable\\flutter\\bin\\cache\\dart-sdk\\bin\\dart.EXE', 'run', 'flutter_launcher_icons']
( ● ) Generating app icons ⏳... ╔════════════════════════════════════════════════════════════════════════════╗
║ The Dart tool uses Google Analytics to anonymously report feature usage ║
║ statistics, and crash reporting to send basic crash reports. This data is ║
║ used to help improve the Dart platform and tools over time. ║
║ ║
║ To disable reporting of anonymous tool usage statistics in general, run ║
║ the command: `dart --disable-analytics`. ║
╚════════════════════════════════════════════════════════════════════════════╝
( ● ) Generating app icons ⏳... Could not find the implicit file to run: bin\flet_flutter_build_tNgMazW40C.dart.
Usage: dart run [arguments] <dart file | package target>
-h, --help Print this usage information.
Debugging options:
--observe=<[<port>[/<bind-address>]]> The observe flag is a convenience flag used to run a program with a set of common options useful for debugging.
Options implied by --observe are currently:
--enable-vm-service=<[<port>[/<bind-address>]]> Enables the VM service and listens on the specified port for connections (default port number is 8181, default bind address is
localhost).
--[no-]pause-isolates-on-exit Pause isolates on exit when running with --enable-vm-service.
--[no-]pause-isolates-on-unhandled-exceptions Pause isolates when an unhandled exception is encountered when running with --enable-vm-service.
--[no-]warn-on-pause-with-no-debugger Print a warning when an isolate pauses with no attached debugger when running with --enable-vm-service.
Other debugging options:
--[no-]pause-isolates-on-start Pause isolates on start when running with --enable-vm-service.
--[no-]enable-asserts Enable assert statements.
Run "dart help" to see global options.
[07:34:43] Deleting Flutter bootstrap directory C:\Users\<user>\AppData\Local\Temp\flet_flutter_build_tNgMazW40C
Run subprocess: ['C:\\Users\\<user>\\AppData\\Local\\flutter\\bin\\flutter.BAT', '--version']
[07:34:44] Error building Flet app - see the log of failed command above.
Dev Env Info
Flet 0.23.2
Python 3.10.0
OS Name Microsoft Windows 11 Pro (Version 10.0.22631 Build 22631)
2024-06-20T00:15:27.3991898Z UnicodeEncodeError: 'charmap' codec can't encode character '\u2705' in position 1: character maps to <undefined>
Add --no-rich-output flag.
@baebranch you issue looks different. Please feel free to file a bug report if you still face it.