Unfortunately, that will not work for a local file sitting in your filesystem, unless it is being served by a server, something like python -m http.server.
Depending on what exactly what you’re trying to do, you might be able to use st.download_button instead to allow the user to download a local file, or simple write the file contents into your app
from pathlib import Path
import streamlit as st
st.write(Path("/home/test.log").read_text())
st.download_button(
"Download file", Path("/home/test.log").read_text(), "test.log"
)
You could use a button to display a local file in the browser. Not as elegant as a hyperlink, but it does the job.
Use the button to trigger the python check_output() function, which can be used to execute a shell commands.
The Windows shell command to execute the default action for a file is: start .
from subprocess import check_output
if st.button('Show Html file'):
file_name = 'index.html'
check_output("start " + file_name, shell=True)