I'm new to all of this python coding and coding in general I need help with these few errors I have on my streamlit app

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit/runtime/scriptrunner/script_runner.py”, line 556, in _run_script
exec(code, module.dict)
File “/Users/x/myproject.py/app.py”, line 117, in
api_key = st.secrets[‘api_key’]
File “/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/streamlit/runtime/secrets.py”, line 228, in getitem
raise KeyError(_missing_key_error_message(key))
KeyError: ‘st.secrets has no key “api_key”. Did you forget to add it to secrets.toml or the app settings on Streamlit Cloud? More info: Secrets management - Streamlit Docs

I have the .streamlit doc with the secrets.toml file with my api and all and I added my secrets to the website swell but still doesnt let me run the app correctly
please help thank you

Hi @hoodpope, welcome to the community! :wave: :partying_face:

Could you confirm the file location of your secrets.toml file? From your traceback, the path to your app is:


Therefore, your secrets file should be located at:


And it should contain the api_key field as follows:




I fixed the issue I just had to change my ’ to " on the apikey lmaooo wtf man