Issue with pywin32 related modules not found after Windows build
Description
Code example to reproduce the issue:
import win32api
import flet as ft
def get_system_info(e):
computer_name = win32api.GetComputerName()
windows_version = win32api.GetVersionEx()
print(f"Computer Name: {computer_name} \nWindows Version: {windows_version}")
def main(page: ft.Page):
page.vertical_alignment = ft.MainAxisAlignment.CENTER
page.horizontal_alignment = ft.CrossAxisAlignment.CENTER
page.window_width = 400
page.window_height = 400
page.add(
ft.Container(
content=ft.Column(
[
ft.ElevatedButton(text="TEST", on_click=get_system_info),
]
),
)
)
ft.app(target=main, assets_dir="assets")
flet build windows
Describe the results you received:
Traceback (most recent call last):
File "<string>", line 43, in <module>
File "<frozen runpy>", line 229, in run_module
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\main\AppData\Local\Temp\serious_python_temp90fa487e\main.py", line 1, in <module>
ModuleNotFoundError: No module named 'win32api'
Describe the results you expected:
Completed execution of the exe file without errors
Additional information you deem important (e.g. issue happens only occasionally):
Flet version (pip show flet):
0.22.1
Give your requirements.txt file (don't pip freeze, instead give direct packages):
flet==0.22.1
pywin32==306
pypiwin32==223
Operating system:
Windows 11
Additional environment details:
i've this error too.. Could'u solve it? I try to import win32print and win32api but if i compile the script send me this error: Traceback (most recent call last): File "", line 43, in File "", line 229, in run_module File "", line 88, in _run_code File "[path]/main.py", line 11, in ModuleNotFoundError: No module named 'win32print'
See here for pywin32 module issues
https://github.com/flet-dev/flet/issues/3029