New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Inconsistent case sensitivity (streamlit run
, st.switch_page
, and the file name)
#8607
Comments
@MathCatsAnd are you working on this or do you want me to take a stab at it? I can at least cover Linux and Windows (don't have a Mac to test on). I think the behavior on Linux might actually be a third option: it is more restrictive than Windows or Mac since you cannot start the app unless the file name case matches exactly, so you don't get into a situation where you have an indeterminate starting state. Testing on Ubuntu on streamlit 1.34.0:
|
I've got my hands full on documentation, so the devs will need to comment on how they want to prioritize and approach this. (And yes, Linux should be tested, too. I just had a Mac laptop and Windows laptop on my desk, so I started there to get the report in.) 😁 |
Thank you @MathCatsAnd for reporting this! @snehankekre IMHO this could fit well in |
@kajarenc dug into this a little more. Unfortunately I'm not even sure that Python 3.12 seems to do better by using a system call to If we're willing to accept that, however, then # execution_control.py
matched_pages = [p for p in all_app_pages if Path(p["script_path"]) == Path(requested_page)] would do the trick for this particular bug. Or, one could store the Path objects themselves in |
@sfc-gh-jcarroll I imagine the |
defer to @kmcgrady but yeah that may make sense - this will be a good one to fix though! Thx for flagging Debbie, Alex and Karen! |
Checklist
Summary
When using
st.switch_page
to go to your app's homepage on a Mac, the function is case sensitive to how the app was initialized withstreamlit run
and not with the actual file name.Reproducible Code Example
Steps To Reproduce
On a Mac (I used Chrome, but the Mac is the important part.)
streamlit run App.py
pages/a.py
results in an error (can't find page).On the other hand
streamilt run app.py
(The app still runs)When I do the same on a Windows computer, there's no problem either way. It's case insensitive.
Expected Behavior
I don't know if I'd expect a Mac to throw an error on
streamlit run
if the case doesn't match, but I definitely thinkst.switch_page
(if it's going to be case sensitive) should match the case of the actual file.Current Behavior
StreamlitAPIException: Could not find page: App.py. Must be the file path relative to the main script, from the directory: Sandbox. Only the main app file and files in the pages/ directory are supported.
Is this a regression?
Debug info
Additional Information
No response
The text was updated successfully, but these errors were encountered: