flet: OSError: [WinError 123] When trying example program

Description The example program crashes at startup. It seems from the traceback that file locations/addresses are not handled correctly somewhere.

Code example to reproduce the issue: Litterally the example program from the wiki

import flet
from flet import IconButton, Page, Row, TextField, icons


def main(page: Page):
    page.title = "Flet counter example"
    page.vertical_alignment = "center"

    txt_number = TextField(value="0", text_align="right", width=100)

    def minus_click(e):
        txt_number.value = int(txt_number.value) - 1
        page.update()

    def plus_click(e):
        txt_number.value = int(txt_number.value) + 1
        page.update()

    page.add(
        Row(
            [
                IconButton(icons.REMOVE, on_click=minus_click),
                txt_number,
                IconButton(icons.ADD, on_click=plus_click),
            ],
            alignment="center",
        )
    )


if __name__ == '__main__':
    flet.app(target=main)

Describe the results you received: Crash with following trace :

  File "C:\Users\User\Miniconda3\Scripts\flet-script.py", line 9, in <module>
    sys.exit(main())
  File "C:\Users\User\Miniconda3\lib\site-packages\flet\flet.py", line 668, in main
    my_observer.start()
  File "C:\Users\User\Miniconda3\lib\site-packages\watchdog\observers\api.py", line 262, in start
    emitter.start()
  File "C:\Users\User\Miniconda3\lib\site-packages\watchdog\utils\__init__.py", line 93, in start
    self.on_thread_start()
  File "C:\Users\User\Miniconda3\lib\site-packages\watchdog\observers\read_directory_changes.py", line 67, in on_thread_start
    self._handle = get_directory_handle(self.watch.path)
  File "C:\Users\User\Miniconda3\lib\site-packages\watchdog\observers\winapi.py", line 316, in get_directory_handle
    return CreateFileW(path, FILE_LIST_DIRECTORY, WATCHDOG_FILE_SHARE_FLAGS,
  File "C:\Users\User\Miniconda3\lib\site-packages\watchdog\observers\winapi.py", line 112, in _errcheck_handle
    raise ctypes.WinError()
OSError: [WinError 123] La syntaxe du nom de fichier, de répertoire ou de volume est incorrecte.
C:\Users\User\Miniconda3\python.exe: can't open file 'C:\\Users\\User\\OneDrive - MyDrive\\Documents\\Tests\\test\\http:\\127.0.0.1:57010': [Errno 22] Invalid argument

Describe the results you expected: The program shouldn’t have crashed and the window should have opened ?

Additional information you deem important (e.g. issue happens only occasionally): If I change the line to make it a browser app, it works without issue

Flet version (pip show flet):

0.1.62

Operating system: Windows 10 x64 Version 10.0.19044 Build 19044

Additional environment details: Was using PyCharm IDE

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 23 (9 by maintainers)

Commits related to this issue

Most upvoted comments

It’s been fixed in Flet 0.2.4 release.