flet-dev / flet

Flet enables developers to easily build realtime web, mobile and desktop apps in Python. No frontend experience required.
https://flet.dev
Apache License 2.0
11.61k stars 455 forks source link

felt build Windows error in Azure Pipelines #4070

Closed suyunSoft closed 2 months ago

suyunSoft commented 2 months ago

Duplicate Check

Describe the bug

I want to use Azure Pipelines to compile a Flet application into a Windows application.

I have installed Flutter, Python 3.10, and Flet 0.24, but when I use the command flet build windows in the command prompt to build the exe, the system reports an error:


  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\flet\cli\commands\build.py", line 360, in handle
    with console.status(
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\status.py", line 106, in __exit__
    self.stop()
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\status.py", line 91, in stop
    self._live.stop()
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\live.py", line 147, in stop
    with self.console:
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\console.py", line 864, in __exit__
    self._exit_buffer()
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\console.py", line 822, in _exit_buffer
    self._check_buffer()
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\console.py", line 2024, in _check_buffer
    self._write_buffer()
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\console.py", line 2060, in _write_buffer
    legacy_windows_render(buffer, LegacyWindowsTerm(self.file))
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\_windows_renderer.py", line 17, in legacy_windows_render
    term.write_styled(text, style)
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\_win32_console.py", line 442, in write_styled
    self.write_text(text)
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\site-packages\rich\_win32_console.py", line 403, in write_text
    self.write(text)
  File "C:\hostedtoolcache\windows\Python\3.10.11\x64\lib\encodings\cp1252.py", line 19, in encode
    return codecs.charmap_encode(input,self.errors,encoding_table)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2705' in position 1: character maps to <undefined>
##[error]Cmd.exe exited with code '1'.

Code sample

Code ```python - task: CmdLine@2 inputs: script: | flet build windows displayName: 'Build Flet Application for Windows' ```

To reproduce

pipelines.yml

trigger:
  branches:
    include:
      - main
      -
stages:
- stage: winStage
  pool:
    vmImage: 'windows-latest'
  dependsOn: []
  displayName: Windows
  jobs:

  - job: windowsJob
    displayName: Windows
    steps:

    - task: FlutterInstall@0
      displayName: "Install Flutter SDK"
      inputs:
        mode: 'auto'
        channel: 'stable'
        version: 'latest'

    - task: UsePythonVersion@0
      inputs:
        versionSpec: '3.10'
        addToPath: true

    - script: |
        python -m pip install --upgrade pip
        pip install -r requirements.txt
      displayName: 'Install Flet and dependencies'

    - task: FlutterCommand@0
      displayName: "Run Flutter diagnostics"
      inputs:
        projectDirectory: '.'
        arguments: 'doctor -v'

    - task: CmdLine@2
      inputs:
        script: |
          flet build windows
      displayName: 'Build Flet Application for Windows'

Expected behavior

No response

Screenshots / Videos

Captures [Upload media here]

Operating System

Windows

Operating system details

Azure Pipelines windows-latest

Flet version

0.24

Regression

No, it isn't

Suggestions

No response

Logs

Logs ```console [Paste your logs here] ```

Additional details

No response

FeodorFitsner commented 2 months ago

Please use Flet 0.24.1 and add --no-rich-output option to flet build command.