直接debug报错
.......,Did you forget to initialize it? More info: https://docs.streamlit.io/library/advanced-features/session-state#initialization'
KeyError:
解决方法:
1.在左侧的运行和调试打开->launch.json:
2.添加以下内容至launch.json
{
"name": "debug streamlit",
"type": "python",
"request": "launch",
"program": "/path/to/streamlit", // /home/xx/tmp/venv/bin/streamlit",
"args": [
"run",
"run.py"
]
}
其中 program后路径替换为streamlit包在你当前环境下的路径
run.py换成你想调试的基于streamlit的python程序路径
3.重新调试,左上角选择debug_streamlit
运行浏览器端响应界面,调试开始!