AttributeError: partially initialized module 'cgi' has no attribute 'FieldStorage' (most likely due

Joined
May 17, 2020
Messages
1
Reaction score
0
Python:
import cgi
import cgitb
import time
cgitb.enable()
now = time.strftime("%A %d %B %Y")
form = cgi.FieldStorage()
name = form.getvalue('name', 'new user')
def print_content():
    print("Content-type: text/html")
    print()
def print_header():
    print("""<html>
     <head>
     <title>Simple CGI form</title>
     </head>
     <body>""")
def print_form():
     print("""
     <form action='form.cgi'>
     Enter your name: <input type='text' name='name' />
     <input type='submit' />
     </form>
     """)
def print_footer():
    print("</body></html>")
print_content()
print_header()
print("""<h1>It's {0!s}!</h1>
<p>Hello {1!s}, your server is correctly set up to run Python programs.</p>""".format(now,
name))
print_form()
print_footer()
 
Last edited by a moderator:

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,060
Latest member
BuyKetozenseACV

Latest Threads

Top