I'm currently trying to add an HTML frontend for a Python program. Essentially, I'm using Python to serve up an HTML file, receive a user input file in the HTML interface, and then have that file passed back to my Python script for manipulation. I've been able to successfully serve my HTML script to localhost, so that I can open it in a browser. I can also input files into that HTML script. The part I'm struggling with is then transferring the input file back over to my Python script, so that it can act on the file. Is that something that I should do with JavaScript inside my HTML file? Or is it something I should do somewhere in my Python script? I assume I'll need a separate thread of my Python program, regardless, because with synchronous execution it can't simultaneously serve the webpage and run the calculations I need. Here is the Python program: import socketserver class MyHttpRequestHandler(http.server.SimpleHTTPRequestHandler): def do_GET(self): self.path = 'webpage.html' return http.server.SimpleHTTPRequestHandler.do_GET(self) handler = MyHttpRequestHandler PORT = 8000 with socketserver.TCPServer(("", PORT), handler) as httpd: print("serving at port", PORT) httpd.serve_forever() #File manipulation (probably in another thread) And the HTML file: <!DOCTYPE html> <html> <head> <title>Analyzer Interface</title> </head> <body> <label for="file_input">Select a file:</label> <input type="file"id="file_input"name="myfile"accept=".txt"> </body> </html> I'm very new to this, so any help/feedback is much appreciated! Continue reading...