我尝试在python中学习破折号应用程序包,我开始使用基本教程,如下所示,
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
我已经尝试了几件事来解决这个问题。但我无法找到解决方案。有人可以帮我解决这个问题吗?
由于
答案 0 :(得分:1)
在禁用调试模式的情况下运行它:
if __name__ == '__main__':
app.run_server(debug=False)