eaglelandsonce commited on
Commit
a56dc07
·
verified ·
1 Parent(s): 6698fa8

Update pages/07_Physics_Test_Sets.py

Browse files
Files changed (1) hide show
  1. pages/07_Physics_Test_Sets.py +5 -2
pages/07_Physics_Test_Sets.py CHANGED
@@ -9,8 +9,11 @@ col1, col2, col3 = st.columns(3)
9
 
10
  # Function to display a clickable download link for the PDF
11
  def create_pdf_link(pdf_name, file_path):
12
- with open(file_path, "rb") as f:
13
- st.download_button(label=pdf_name, data=f, file_name=pdf_name, mime="application/pdf")
 
 
 
14
 
15
  # Display the first PDF link as a clickable download button in the first column
16
  with col1:
 
9
 
10
  # Function to display a clickable download link for the PDF
11
  def create_pdf_link(pdf_name, file_path):
12
+ if os.path.exists(file_path):
13
+ with open(file_path, "rb") as f:
14
+ st.download_button(label=pdf_name, data=f, file_name=pdf_name, mime="application/pdf")
15
+ else:
16
+ st.error(f"File {pdf_name} not found!")
17
 
18
  # Display the first PDF link as a clickable download button in the first column
19
  with col1: