Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/python-2.7/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 尝试dash应用程序时使用stat重新启动_Python_Python 2.7_Flask - Fatal编程技术网

Python 尝试dash应用程序时使用stat重新启动

Python 尝试dash应用程序时使用stat重新启动,python,python-2.7,flask,Python,Python 2.7,Flask,我正在尝试学习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) 但我得到了以

我正在尝试学习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
---------------------------------------------------------------------------
SystemExit回溯(最后一次最近调用)
在()
32
33如果uuuu name uuuuuu=='\uuuuuuuu main\uuuuuuuuuu':
--->34 app.run_服务器(debug=True)
C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site packages\dash\dash.pyc in run\u服务器(self、port、debug、**flask\u run\u选项)
564调试=错误,
565**烧瓶(运行选项):
-->566 self.server.run(端口=端口,调试=调试,**flask\u运行\u选项)
C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site packages\flask\app.pyc正在运行(self、host、port、debug、**选项)
839 options.setdefault('use_debugger',self.debug)
840尝试:
-->841简单运行(主机、端口、自身,**选项)
842最后:
843#如果开发服务器
C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site packages\werkzeug\service.pyc in run\u simple(主机名、端口、应用程序、使用\u重载器、使用\u调试器、使用\u evalex、额外\u文件、重载器\u间隔、重载器\u类型、线程、进程、请求\u处理程序、静态\u文件、传递\u错误、ssl\u上下文)
来自werkzeug的735。重新装载机导入使用重新装载机运行
736使用重新加载程序运行(内部、额外文件、重新加载程序间隔、,
-->737装载机(U型)
738其他:
739内部()
C:\Users\username\AppData\Local\Continuum\anaconda27\lib\site packages\werkzeug\\ u reloader.pyc在运行时使用\u reloader(主函数、额外文件、间隔、重载类型)
263重新加载程序。运行()
264其他:
-->265系统退出(重新加载程序。使用重新加载程序()重新启动)
266除键盘中断外:
267通行证
系统出口:1
我试过几种方法来解决这个问题。但我无法找到解决办法。有谁能帮我解决这个问题吗


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

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

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