AttributeError

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daniger
    New Member
    • Nov 2008
    • 1

    AttributeError

    I keep getting the error:

    Traceback (most recent call last):
    File "E:/Documents and Settings/Lidia/Desktop/Code/unidisp2.py", line 3, in <module>
    form = cgi.FieldStorag e()
    AttributeError: 'module' object has no attribute 'FieldStorage'

    My code is:

    Code:
    import cgi
    import unicodedata
    form = cgi.FieldStorage()
    Start = int(form["Start"].value)
    End = int(form["End"].value)
    
    print "Content-Type: text/html"
    print"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <head>
    <title>Unicode Characters</title>
    </head>
    <body>
    <h1>Unicode Characters</h1>
    
    <table class="characters">
    <caption>Defined Unicode characters 165&ndash;172</caption>
    <thead>
    <tr><th scope="col" abbr="num">Number</th><th scope="col" abbr="entity">HTML Entity</th><th scope="col" abbr="char">Character</th><th scope="col" abbr="name">Name</th></tr>
    
    </thead>
    <tbody>"""
    
    for char in range(start,end+1):
        name = unicodedata.name(unichr(char), "undefined")
        print "<tr><td class=\"num\">" + str(char) + "</td>"
        print "<td><code class=\"html\">&amp;#" + str(char) + ";</code>"
        print "</td><td class=\"char\"><span>&#" + str(char) + ";</span></td>"
        print "<td class=\"name\">" + name + "</td></tr>"
    
    print "</tbody></table>"
    print "</body></html>"
    can anyone help with this?
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    I don't see a problem with the import. cgi.FieldStorag e() is available on my system upon import. What does dir(cgi) show?

    Comment

    Working...