【问题标题】:Restarting with stat when trying dash app尝试破折号应用程序时使用 stat 重新启动
【发布时间】:2018-08-12 01:44:50
【问题描述】:

我正在尝试学习python中的dash应用程序包,我从基础教程开始,如下所示,

import dash
import dash_core_components as dcc
import dash_html_components as html

app = dash.Dash()

app.layout = html.Div(' Dash Tutorials')

if __name__ == '__main__':
    app.run_server(debug=True)

但我收到以下错误,

* Restarting with stat

An exception has occurred, use %tb to see the full traceback.

SystemExit: 1

当我输入 %tb 时,显示的是以下内容,

---------------------------------------------------------------------------
SystemExit                                Traceback (most recent call last)
<ipython-input-5-5d4a332652ef> in <module>()
     32 
     33 if __name__ == '__main__':
---> 34     app.run_server(debug=True)

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\dash\dash.pyc in run_server(self, port, debug, **flask_run_options)
    564                    debug=False,
    565                    **flask_run_options):
--> 566         self.server.run(port=port, debug=debug, **flask_run_options)

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\flask\app.pyc in run(self, host, port, debug, **options)
    839         options.setdefault('use_debugger', self.debug)
    840         try:
--> 841             run_simple(host, port, self, **options)
    842         finally:
    843             # reset the first request information if the development server

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\werkzeug\serving.pyc in run_simple(hostname, port, application, use_reloader, use_debugger, use_evalex, extra_files, reloader_interval, reloader_type, threaded, processes, request_handler, static_files, passthrough_errors, ssl_context)
    735         from werkzeug._reloader import run_with_reloader
    736         run_with_reloader(inner, extra_files, reloader_interval,
--> 737                           reloader_type)
    738     else:
    739         inner()

C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site-packages\werkzeug\_reloader.pyc in run_with_reloader(main_func, extra_files, interval, reloader_type)
    263             reloader.run()
    264         else:
--> 265             sys.exit(reloader.restart_with_reloader())
    266     except KeyboardInterrupt:
    267         pass

SystemExit: 1

我已经尝试了几种方法来解决这个问题。但我无法找到解决方案。有人可以帮我解决这个问题吗?

谢谢

【问题讨论】:

  • 几个问题可能有助于调试,也可能无济于事: 1. 你的回溯的最后一次调用中的if 语句是什么? 2. 你在 Windows 上运行吗?
  • 如果您使用的是 Spyder,请尝试 debug=False。
  • @ScarletAndGray 谢谢!它也适用于 Jupyter 笔记本。

标签: python python-2.7 flask


【解决方案1】:

在禁用调试模式的情况下运行它:

if __name__ == '__main__':
    app.run_server(debug=False)

【讨论】:

    猜你喜欢
    • 2015-03-30
    • 2019-05-19
    • 2021-03-09
    • 1970-01-01
    • 2019-12-22
    • 2013-06-24
    • 2014-11-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多