【问题标题】:Why does Dash throw a TypeError when debugging through PyCharm? [closed]为什么 Dash 在通过 PyCharm 调试时会抛出 TypeError? [关闭]
【发布时间】:2021-12-22 21:09:57
【问题描述】:

当我尝试在调试模式下从 PyCharm 运行 Dash 应用程序时,我不断收到以下TypeError。我可以做些什么来解决这个问题,以便我可以在 PyCharm 中的断点处中断?

我正在使用:Dash 2.0.0、Python 3.9.6、PyCharm Community Edition 2021.1.3、Windows 10。

Connected to pydev debugger (build 212.4746.96)
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\pydevd.py", line 1483, in _exec
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:\Program Files (x86)\JetBrains\PyCharm Community Edition 2021.1.3\plugins\python-ce\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
    exec(compile(contents+"\n", file, 'exec'), glob, loc)
  File "C:/redacted/dashboard/dashboard.py", line 170, in <module>
    _app = dash.Dash(__name__, external_stylesheets=[dbc.themes.DARKLY])
  File "C:\redacted\.venv\lib\site-packages\dash\dash.py", line 304, in __init__
    self.server = flask.Flask(name) if server else None
  File "C:\redacted\.venv\lib\site-packages\flask\app.py", line 406, in __init__
    instance_path = self.auto_find_instance_path()
  File "C:\redacted\.venv\lib\site-packages\flask\app.py", line 638, in auto_find_instance_path
    prefix, package_path = find_package(self.import_name)
  File "C:\redacted\.venv\lib\site-packages\flask\scaffold.py", line 850, in find_package
    package_path = _find_package_path(root_mod_name)
  File "C:\redacted\.venv\lib\site-packages\flask\scaffold.py", line 801, in _find_package_path
    return os.path.dirname(next(iter(spec.submodule_search_locations)))
TypeError: 'NoneType' object is not iterable
python-BaseException

Process finished with exit code 1

以下是我设置 PyCharm 运行配置的方式:

【问题讨论】:

    标签: python flask pycharm plotly-dash


    【解决方案1】:

    可能是 PyCharm 中的一个错误。通过将 PyCharm 升级到 2021.2.3 解决。

    【讨论】:

    • 已确认。 2021.2.3 解决了这个问题。谢谢@urig!
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-12-03
    • 2015-02-26
    • 1970-01-01
    • 2020-06-22
    • 1970-01-01
    相关资源
    最近更新 更多