examples icon indicating copy to clipboard operation
examples copied to clipboard

运行trolli出现'NoneType' object has no attribute 'width'错误

Open get-Resource opened this issue 1 year ago • 7 comments

我安装以下步骤运行,然后收到'NoneType' object has no attribute 'width'异常

git clone https://github.com/flet-dev/examples.git
cd examples\python\apps\trolli
pip3 install -r requirements.txt
python3 ./src/main.py
Unhandled error processing page session : Traceback (most recent call last):
  File "D:\Procedure\LanguageInterpreter\Python310\lib\site-packages\flet_runtime\app.py", line 363, in on_session_created
    session_handler(page)
  File "E:\SourceCode\gitlab\examples\python\apps\trolli\src\main.py", line 207, in main
    app.initialize()
  File "E:\SourceCode\gitlab\examples\python\apps\trolli\src\main.py", line 86, in initialize
    self.create_new_board("My First Board")
  File "E:\SourceCode\gitlab\examples\python\apps\trolli\src\main.py", line 187, in create_new_board
    new_board = Board(self, self.store, board_name)
  File "E:\SourceCode\gitlab\examples\python\apps\trolli\src\board.py", line 49, in __init__
    width=(self.app.page.width - 310),
AttributeError: 'NoneType' object has no attribute 'width'

经过分析发现在src\main.py:83 self.page.update()后self.page就会等于None 跟踪下去是flet_core\page.py:466 ctrl.page = None 将其赋值为None

请问是什么问题导致的呢,以下是我的版本

Python 3.10.7 flet 0.12.0 flet-core 0.12.0 flet-fastapi 0.12.0 flet-runtime 0.12.0

get-Resource avatar Nov 13 '23 03:11 get-Resource

我将flet_core\page.py:466 ctrl.page = None 改为 if ctrl.page != self: ctrl.page = None 就不出现这个异常了,我不了解为啥需要设置为None

get-Resource avatar Nov 13 '23 03:11 get-Resource

I installed flet==0.3.2 which temporarily solved the issue. What might be the cause ? Trelloi needs to get updated

Pranzal360 avatar Nov 23 '23 19:11 Pranzal360

Trelloi needs to get updated.

That's right.

FeodorFitsner avatar Nov 23 '23 19:11 FeodorFitsner

@FeodorFitsner Are you guys not planning to fix this? I'm blocked because of this. was planning to propose flet for development to my org but now I can't.

sumitkanoje avatar Jan 12 '24 17:01 sumitkanoje

@sumitkanoje you mean fixing Trolli app?

FeodorFitsner avatar Jan 12 '24 18:01 FeodorFitsner

@FeodorFitsner not the Trolli app but the issue that causes this error in Trolli app? or let me know any way to fix this without downgrading the app?

As mentioned by @get-Resource flet_core\page.py:466 ctrl.page = None should be replaced with if ctrl.page != self: ctrl.page = None

sumitkanoje avatar Jan 13 '24 17:01 sumitkanoje

In same issue Here link wich help me https://github.com/flet-dev/examples/issues/104#issuecomment-1851756942

MusienkoAnton avatar Jan 15 '24 06:01 MusienkoAnton