-
Notifications
You must be signed in to change notification settings - Fork 4k
Closed
Labels
feature:st.secretsRelated to `st.secrets`Related to `st.secrets`priority:P3Medium priorityMedium prioritystatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected
Description
Checklist
- I have searched the existing issues for similar issues.
- I added a very descriptive title to this issue.
- I have provided sufficient information below to help reproduce this issue.
Summary
Whenever accessing st.secrets in an app, Streamlit raises exceptions in two different manners [see source]:
- using
st.exception(...) - raising an actual
FileNotFoundErrorexception
This leads to two issues:
- Duplicated exception messages being shown (even more, weirdly)
- Makes it impossible to test if secrets exist without an exception to be written
Reproducible Code Example
token = None
try:
if "TOKEN" in st.secrets:
token = st.secrets["TOKEN"]
except FileNotFoundError:
pass
if not token:
token = st.text_input("Pass in your token!", type="password")Steps To Reproduce
No response
Expected Behavior
Do not show any exception, since I'm trying to catch it. Basically, get rid of lines 212 and 213 in here!
streamlit/lib/streamlit/runtime/secrets.py
Lines 212 to 213 in 940bd5d
| if print_exceptions: | |
| st.error(err_msg) |
Current Behavior
An exception message is hard-coded and shown regardless if I catch it
Is this a regression?
- Yes, this used to work in a previous version.
Debug info
- Streamlit version: 1.32.1
- Python version: 3.9
- Operating System: OSX
- Browser: Chrome
Additional Information
No response
github-actions, jrieke, snehankekre, aumisb and Asaurus1
Metadata
Metadata
Assignees
Labels
feature:st.secretsRelated to `st.secrets`Related to `st.secrets`priority:P3Medium priorityMedium prioritystatus:confirmedBug has been confirmed by the Streamlit teamBug has been confirmed by the Streamlit teamtype:bugSomething isn't working as expectedSomething isn't working as expected