1. 程式人生 > >AttributeError: 'NoneType' object has no attribute 'name'

AttributeError: 'NoneType' object has no attribute 'name'

python 使用 reload 功能時,修改模組檔案內容,執行到reload如上報錯

 

File "C:\Python36-32\lib\importlib\__init__.py", line 166, in reload
    _bootstrap._exec(spec, module)
  File "<frozen importlib._bootstrap>", line 589, in _exec
AttributeError: 'NoneType' object has no attribute 'name'

原因是:

主程式迴圈太快了,增加sleep(1),能解決,具體原因待查