为什么 Dash 在通过 PyCharm 进行调试时会抛出 TypeError?

Why does Dash throw a TypeError when debugging through PyCharm?

当我在调试模式下尝试 运行 来自 PyCharm 的 Dash 应用程序时,我不断收到以下 TypeError。我该怎么做才能解决此问题,以便我可以在 PyCharm?

中的断点处中断

我正在使用:Dash 2.0.0,Python 3.9.6,PyCharm 社区版 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 运行 配置的方式:

可能是 PyCharm 中的错误。通过将 PyCharm 升级到 2021.2.3.

解决