Python Forum
How to run a python file from html hyperlinks
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to run a python file from html hyperlinks
#1
I connected the local host and when I click the link (timing data) from my browser i get plain python code displayed in my page.
Need to know how CGI is running python file.

code:
<p>
For now, all that you'll find here is my athlete's <a href="/webapp/cgi-bin/generate_list.py">timing data</a>. Enjoy!
</p>

Output:
import cgi
import athletemodel
import yate
import glob

data_files = glob.glob("data/*.txt")
athletes = athletemodel.put_to_store(data_files)

print(yate.start_response())
print(yate.include_header("Coach Kelly's List of Athletes"))
print(yate.start_form("generate_timing_data.py"))
print(yate.para("Select an athlete from the list to work with:"))
for each_athlete in athletes:
print(yate.radio_button("which_athlete", athletes[each_athlete].name))
print(yate.end_form("Select"))
print(yate.include_footer({"Home": "/index.html"}))
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need to replace a string with a file (HTML file) tester_V 1 699 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  Tkinterweb (Browser Module) Appending/Adding Additional HTML to a HTML Table Row AaronCatolico1 0 877 Dec-25-2022, 06:28 PM
Last Post: AaronCatolico1
  HTML file crashes program mikefirth 12 3,704 Dec-31-2021, 03:57 AM
Last Post: Pedroski55
  reading html and edit chekcbox to html jacklee26 5 3,020 Jul-01-2021, 10:31 AM
Last Post: snippsat
  code for CSV file to html file without pandas jony057 1 2,909 Apr-24-2021, 09:41 PM
Last Post: snippsat
  Making .exe file that requires access to text and html files ClassicalSoul 0 1,552 Apr-23-2020, 05:03 PM
Last Post: ClassicalSoul
  importing CSV file into a HTML table using Python trybakov 1 2,247 Feb-22-2020, 09:47 PM
Last Post: scidam
  How do I read the HTML files in a directory and write the content into a CSV file? glittergirl 1 2,559 Sep-23-2019, 11:01 AM
Last Post: Larz60+
  HTML to Python to Windows .bat and back to HTML perfectservice33 0 1,918 Aug-22-2019, 06:31 AM
Last Post: perfectservice33
  How to Find & Count String Patterns Between two Markers in a HTML file ahmedwaqas92 3 2,904 Aug-19-2019, 10:12 AM
Last Post: ahmedwaqas92

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020