When input is finished, Chrome doesn’ run the Test.py file, only shows the code in the browser:
#!/usr/bin/python
import cgi
form = cgi.FieldStorage() # parse form data
print(‘Content-type: text/html\n’) # hdr plus blank line
print(‘Reply Page’) # html reply page
if not ‘user’ in form:
print(‘
Who are you?
’)
else:
print(‘
Hello %s!
’ % cgi.escape(form[‘user’].value))
Can somebody plse explain me what’s the issue here?
Please put your code inside code-fences/preformatted text like this:
```
def main():
print('Hello')
```
Web browsers do not run scripts as you seem to be attempting to do.
That is the job of a web server. Have you added your script to a web server? What web server and running on what OS?
Also its more usual for the CGI script to be named test.cgi not test.html.
For example with apache httpd I would put the test.cgi in its cgi-bin folder.