Streamlit.exe "Access is denied" - Solution

This post is similar to this one: [Errno 13] Permission denied: - Community Cloud - Streamlit and this SO question: [ Access denied after running streamlit hello](python - Access denied after running streamlit hello - Stack Overflow), which I provided an answer for here.

Python version: 3.11, streamlit version: 1.40.1

If you encounter an error like this:

Text version:

Program 'streamlit.exe' failed to run: Access is deniedAt line:1 char:1
+ streamlit run .\main.py
+ ~~~~~~~~~~~~~~~~~~~~~~~.
At line:1 char:1
+ streamlit run .\main.py
+ ~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ResourceUnavailable: (:) [], ApplicationFailedException
    + FullyQualifiedErrorId : NativeCommandFailed

Then what worked for me was running this command:

.\.conda\Scripts\streamlit.cmd run .\main.py

I.e., run streamlit.cmd instead of streamlit.exe.

I don’t know why it worked, but it did :]