flet-dev / examples

Flet sample applications
MIT License
423 stars 172 forks source link

Failed to run trolli app in 0.8.0 (no problem in 0.7.4) #87

Closed litalidev closed 2 weeks ago

litalidev commented 1 year ago

In 0.7.4, the app run fine. However, after upgrading to flet 0.8.0, it failed to run

Step to re-produce (Windows 11, official cpython 3.11.4, 64bit)

  1. install python (i'm using venv)
  2. git clone the examples repo
  3. cd to examples/python/apps/trolli/src
  4. pip install -r requirements.txt
  5. run the trolli app
  6. Error occurs (only in 0.8.0, works fine in 0.7.4)
  7. Seems like the self.page in app was set to None.

Here is the full log (including 0.7.4 and 0.8.0)


(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>python Python 3.11.4 (tags/v3.11.4:d2340ef, Jun 7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license" for more information.

^Z

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>pip freeze | grep flet flet==0.7.4 flet-core==0.7.4

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>git show head | head -3 commit 0b0c25be1947637751ce85ca0f134a974b9beed5 Author: Feodor Fitsner feodor@appveyor.com Date: Wed Jul 5 18:50:27 2023 -0700

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>python main.py

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>pip install --upgrade flet Requirement already satisfied: flet in d:\prg\venv\flet1\lib\site-packages (0.7.4) Collecting flet Using cached flet-0.8.0-py3-none-win_amd64.whl (22.7 MB) Collecting copier<9.0.0,>=8.0.0 (from flet) Using cached copier-8.0.0-py3-none-any.whl (38 kB) Collecting flet-runtime==0.8.0 (from flet) Using cached flet_runtime-0.8.0-py3-none-any.whl (20 kB) Requirement already satisfied: packaging<24.0,>=23.1 in d:\prg\venv\flet1\lib\site-packages (from flet) (23.1) Collecting pydantic<2 (from flet) Using cached pydantic-1.10.11-cp311-cp311-win_amd64.whl (2.1 MB) Collecting qrcode<8.0.0,>=7.4.2 (from flet) Using cached qrcode-7.4.2-py3-none-any.whl (46 kB) Collecting watchdog<4.0.0,>=3.0.0 (from flet) Using cached watchdog-3.0.0-py3-none-win_amd64.whl (82 kB) Requirement already satisfied: websocket-client<2.0.0,>=1.5.2 in d:\prg\venv\flet1\lib\site-packages (from flet) (1.6.1) Collecting websockets<12.0.0,>=11.0.3 (from flet) Using cached websockets-11.0.3-cp311-cp311-win_amd64.whl (124 kB) Collecting flet-core==0.8.0 (from flet-runtime==0.8.0->flet) Using cached flet_core-0.8.0-py3-none-any.whl (246 kB) Collecting httpx<0.25.0,>=0.24.1 (from flet-runtime==0.8.0->flet) Using cached httpx-0.24.1-py3-none-any.whl (75 kB) Requirement already satisfied: oauthlib<4.0.0,>=3.2.2 in d:\prg\venv\flet1\lib\site-packages (from flet-runtime==0.8.0->flet) (3.2.2) Requirement already satisfied: repath<0.10.0,>=0.9.0 in d:\prg\venv\flet1\lib\site-packages (from flet-core==0.8.0->flet-runtime==0.8.0->flet) (0.9.0) Collecting colorama>=0.4.3 (from copier<9.0.0,>=8.0.0->flet) Using cached colorama-0.4.6-py2.py3-none-any.whl (25 kB) Collecting decorator>=5.1.1 (from copier<9.0.0,>=8.0.0->flet) Using cached decorator-5.1.1-py3-none-any.whl (9.1 kB) Collecting dunamai>=1.7.0 (from copier<9.0.0,>=8.0.0->flet) Using cached dunamai-1.17.0-py3-none-any.whl (24 kB) Collecting funcy>=1.17 (from copier<9.0.0,>=8.0.0->flet) Using cached funcy-2.0-py2.py3-none-any.whl (30 kB) Collecting jinja2>=3.1.1 (from copier<9.0.0,>=8.0.0->flet) Using cached Jinja2-3.1.2-py3-none-any.whl (133 kB) Collecting jinja2-ansible-filters>=1.3.1 (from copier<9.0.0,>=8.0.0->flet) Using cached jinja2_ansible_filters-1.3.2-py3-none-any.whl (18 kB) Collecting pathspec>=0.9.0 (from copier<9.0.0,>=8.0.0->flet) Using cached pathspec-0.11.1-py3-none-any.whl (29 kB) Collecting plumbum>=1.6.9 (from copier<9.0.0,>=8.0.0->flet) Using cached plumbum-1.8.2-py3-none-any.whl (127 kB) Collecting pygments>=2.7.1 (from copier<9.0.0,>=8.0.0->flet) Using cached Pygments-2.15.1-py3-none-any.whl (1.1 MB) Collecting pyyaml>=5.3.1 (from copier<9.0.0,>=8.0.0->flet) Using cached PyYAML-6.0-cp311-cp311-win_amd64.whl (143 kB) Collecting pyyaml-include>=1.2 (from copier<9.0.0,>=8.0.0->flet) Using cached pyyaml_include-1.3.1-py3-none-any.whl (20 kB) Collecting questionary>=1.8.1 (from copier<9.0.0,>=8.0.0->flet) Using cached questionary-1.10.0-py3-none-any.whl (31 kB) Collecting typing-extensions>=4.2.0 (from pydantic<2->flet) Using cached typing_extensions-4.7.1-py3-none-any.whl (33 kB) Collecting pypng (from qrcode<8.0.0,>=7.4.2->flet) Using cached pypng-0.20220715.0-py3-none-any.whl (58 kB) Requirement already satisfied: certifi in d:\prg\venv\flet1\lib\site-packages (from httpx<0.25.0,>=0.24.1->flet-runtime==0.8.0->flet) (2023.5.7) Requirement already satisfied: httpcore<0.18.0,>=0.15.0 in d:\prg\venv\flet1\lib\site-packages (from httpx<0.25.0,>=0.24.1->flet-runtime==0.8.0->flet) (0.16.3) Requirement already satisfied: idna in d:\prg\venv\flet1\lib\site-packages (from httpx<0.25.0,>=0.24.1->flet-runtime==0.8.0->flet) (3.4) Requirement already satisfied: sniffio in d:\prg\venv\flet1\lib\site-packages (from httpx<0.25.0,>=0.24.1->flet-runtime==0.8.0->flet) (1.3.0) Collecting MarkupSafe>=2.0 (from jinja2>=3.1.1->copier<9.0.0,>=8.0.0->flet) Using cached MarkupSafe-2.1.3-cp311-cp311-win_amd64.whl (17 kB) Collecting pywin32 (from plumbum>=1.6.9->copier<9.0.0,>=8.0.0->flet) Using cached pywin32-306-cp311-cp311-win_amd64.whl (9.2 MB) Collecting prompt_toolkit<4.0,>=2.0 (from questionary>=1.8.1->copier<9.0.0,>=8.0.0->flet) Using cached prompt_toolkit-3.0.39-py3-none-any.whl (385 kB) Requirement already satisfied: h11<0.15,>=0.13 in d:\prg\venv\flet1\lib\site-packages (from httpcore<0.18.0,>=0.15.0->httpx<0.25.0,>=0.24.1->flet-runtime==0.8.0->flet) (0.14.0) Requirement already satisfied: anyio<5.0,>=3.0 in d:\prg\venv\flet1\lib\site-packages (from httpcore<0.18.0,>=0.15.0->httpx<0.25.0,>=0.24.1->flet-runtime==0.8.0->flet) (3.7.1) Collecting wcwidth (from prompt_toolkit<4.0,>=2.0->questionary>=1.8.1->copier<9.0.0,>=8.0.0->flet) Using cached wcwidth-0.2.6-py2.py3-none-any.whl (29 kB) Requirement already satisfied: six>=1.9.0 in d:\prg\venv\flet1\lib\site-packages (from repath<0.10.0,>=0.9.0->flet-core==0.8.0->flet-runtime==0.8.0->flet) (1.16.0) Installing collected packages: wcwidth, pywin32, pypng, funcy, websockets, watchdog, typing-extensions, pyyaml, pygments, prompt_toolkit, plumbum, pathspec, MarkupSafe, dunamai, decorator, colorama, questionary, qrcode, pyyaml-include, pydantic, jinja2, flet-core, jinja2-ansible-filters, httpx, flet-runtime, copier, flet Attempting uninstall: websockets Found existing installation: websockets 10.4 Uninstalling websockets-10.4: Successfully uninstalled websockets-10.4 Attempting uninstall: watchdog Found existing installation: watchdog 2.3.1 Uninstalling watchdog-2.3.1: Successfully uninstalled watchdog-2.3.1 Attempting uninstall: flet-core Found existing installation: flet-core 0.7.4 Uninstalling flet-core-0.7.4: Successfully uninstalled flet-core-0.7.4 Attempting uninstall: httpx Found existing installation: httpx 0.23.3 Uninstalling httpx-0.23.3: Successfully uninstalled httpx-0.23.3 Attempting uninstall: flet Found existing installation: flet 0.7.4 Uninstalling flet-0.7.4: Successfully uninstalled flet-0.7.4 Successfully installed MarkupSafe-2.1.3 colorama-0.4.6 copier-8.0.0 decorator-5.1.1 dunamai-1.17.0 flet-0.8.0 flet-core-0.8.0 flet-runtime-0.8.0 funcy-2.0 httpx-0.24.1 jinja2-3.1.2 jinja2-ansible-filters-1.3.2 pathspec-0.11.1 plumbum-1.8.2 prompt_toolkit-3.0.39 pydantic-1.10.11 pygments-2.15.1 pypng-0.20220715.0 pywin32-306 pyyaml-6.0 pyyaml-include-1.3.1 qrcode-7.4.2 questionary-1.10.0 typing-extensions-4.7.1 watchdog-3.0.0 wcwidth-0.2.6 websockets-11.0.3

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>pip freeze | grep flet flet==0.8.0 flet-core==0.8.0 flet-runtime==0.8.0

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>python main.py Unhandled error processing page session : Traceback (most recent call last): File "d:\prg\venv\flet1\Lib\site-packages\flet_runtime\app.py", line 357, in on_session_created session_handler(page) File "P:\prj\python\flet\examples\python\apps\trolli\src\main.py", line 207, in main app.initialize() File "P:\prj\python\flet\examples\python\apps\trolli\src\main.py", line 86, in initialize self.create_new_board("My First Board") File "P:\prj\python\flet\examples\python\apps\trolli\src\main.py", line 187, in create_new_board new_board = Board(self, self.store, board_name) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "P:\prj\python\flet\examples\python\apps\trolli\src\board.py", line 49, in init width=(self.app.page.width - 310), ^^^^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'width'

Exception in thread Thread-5 (sync_handler): Traceback (most recent call last): File "D:\prg\python\3.11_64\Lib\threading.py", line 1038, in _bootstrap_inner self.run() File "D:\prg\python\3.11_64\Lib\threading.py", line 975, in run self._target(*self._args, **self._kwargs) File "d:\prg\venv\flet1\Lib\site-packages\flet_core\event_handler.py", line 30, in sync_handler h(e) File "P:\prj\python\flet\examples\python\apps\trolli\src\app_layout.py", line 130, in page_resize self.page.update() ^^^^^^^^^^^^^^^^ AttributeError: 'NoneType' object has no attribute 'update'

(flet1) P:\prj\python\flet\examples\python\apps\trolli\src>

FeodorFitsner commented 1 year ago

Closing as dup of https://github.com/flet-dev/flet/issues/1553

ndonkoHenri commented 2 weeks ago

Issue has been fixed in https://github.com/flet-dev/examples/pull/127 Please give another try.