Fix for "streamlit run" - when no file extension is provided#2115
Merged
tconkling merged 1 commit intostreamlit:developfrom Oct 7, 2020
Merged
Fix for "streamlit run" - when no file extension is provided#2115tconkling merged 1 commit intostreamlit:developfrom
tconkling merged 1 commit intostreamlit:developfrom
Conversation
Contributor
|
I agree with @randyzwitch that this is an obvious win. Marking "approve" on the basis that it fixes a known community pain point; we still need 1 more Core approver to make it official. |
nthmost
approved these changes
Oct 7, 2020
Contributor
|
Looks great - thanks @abhinand5! |
Contributor
Author
|
Thanks 😃 @treuille @nthmost @randyzwitch |
tconkling
added a commit
to tconkling/streamlit
that referenced
this pull request
Oct 12, 2020
# By karrie (7) and others # Via GitHub * develop: Removing cache option from main menu if s4a (streamlit#2149) Fix empty deploy page (streamlit#2148) Don't wait for unit tests before starting Cypress (streamlit#2142) Fix formatting of st.file_uploader docstring (streamlit#2141) Fix broken link in 0.68 changelog (streamlit#2144) Fix useEffect warning (streamlit#2137) Add global GTM container (streamlit#2128) Allow Streamlit server to handle Range Requests (streamlit#1967) rename hosted to hostedAt (streamlit#2132) Update change log Update notices Up version to 0.68.0 Rename hosted to hostedAt in tracking data (streamlit#2132) Inject tracking data (streamlit#2110) [Feature Branch] File uploader (streamlit#2130) links for docs (streamlit#2129) Upgrade ProtobufJS and fix build script (streamlit#2118) Refresh landing page (streamlit#2116) Improve docstrings + tutorials for Layout (streamlit#2117) Better 'streamlit run' error message when no extension provided (streamlit#2115) # Conflicts: # frontend/src/components/elements/Video/Video.tsx # frontend/src/components/widgets/FileUploader/FileUploader.test.tsx # frontend/src/components/widgets/FileUploader/FileUploader.tsx # frontend/src/lib/utils.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2107
What was the issue?
When the
streamlit runcommand is executed with a filename that does not have an extension the error message shown on the CLI was incorrect as discussed in the Issue thread #2107The fix
Problem was in the
cli.pyfile where the run command is defined. In lines 206 to 210 where the extension is checked.When only the filename is provided without extension, checking only the
extension[1:] not in ACCEPTED_FILE_EXTENSIONSwill result in an empty string because of the output fromos.path.splitextreturns empty string for the extension when none is provided. This behaviour is illustrated in the image below,This results in this weird error message
"Streamlit requires raw Python (.py) files, not ."which does not make sense and might confuse some absolute beginners.The fix was to add another statement to check if there is an extension provided and display a proper error message when not.