My problem was that I was running my application from a different PYTHONPATH than where is my app.py - because my application structure looks like that for deployment purposes.
The PYTHONPATH (path, where Python looks for modules) is set to the root directory of the project (one directory up to the /dash_app directory where app.py - DASH object is instantiated)
2条答案
按热度按时间7d7tgy0s1#
你使用破折号多页插件吗?你能提供你的代码和项目结构吗?
/dash_app
directory where app.py - DASH object is instantiated)在
dash_app/pages/afterlogin.py
文件上,我正在注册一个新页面:dash.register_page(__name__)
afterlogin.py
导入到另一个脚本dash_app/callback_extensions/login_callbacks.py
。Exception: modules ['dash_app.pages.afterlogin', 'pages.afterlogin'] have duplicate paths
afterlogin.py
文件中的导入时,问题得到了解决。我的猜测是. ipynb_checkpoints中存在对页面app_Km. py的引用,但路径不同(就像我的例子一样,模块相同,但引用不同),这造成了"冲突",DASH将其评估为不同的模块,而实际上它只是对同一个模块的引用。**建议:
希望这能帮上忙。
68bkxrlz2#
我有同样的问题,它是在删除.ipynb_checkpoint文件夹或 .py文件(在您的情况下,“app_Km-检查点”)在该文件夹后消失。
在JupyterLab中,不仅JupyterNotebook而且Python文件(.py)看起来都像是自动保存在.ipynb_checkpoints中的。