StreamlitAPIException: set_page_config()

Hello, everyone.
My program prompt error, code only write once, why will prompt.
StreamlitAPIException : set_page_config() can only be called once per app, and must be called as the first Streamlit command in your script.


Hi @haha :wave:

I suspect one or more of the pages / packages you import (DRGtest_web or About or help) also call st.set_page_config(). The fix would be to either not import the pages or exclude st.set_page_config() in the imported pages.

It gives an error periodically, not every time it runs, and set_page_config is not in the.py code.

A copy of the code, perhaps in a GitHub repo would help us debug. Without looking at the code we can only guess what the issue is.

Note: as the error says, st.set_page_config() must be the first Streamlit command in your script. If you’ve called Streamlit commands in the pages you import, you will see this error.

谢谢.
好像是其他脚本自动调用了main方法.导致这个问题,

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.