By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,922 Members | 1,493 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,922 IT Pros & Developers. It's quick & easy.

AttributeError

P: 1
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.FieldStorage()
AttributeError: 'module' object has no attribute 'FieldStorage'

My code is:

Expand|Select|Wrap|Line Numbers
  1. import cgi
  2. import unicodedata
  3. form = cgi.FieldStorage()
  4. Start = int(form["Start"].value)
  5. End = int(form["End"].value)
  6.  
  7. print "Content-Type: text/html"
  8. print"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  9. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  10. <head>
  11. <title>Unicode Characters</title>
  12. </head>
  13. <body>
  14. <h1>Unicode Characters</h1>
  15.  
  16. <table class="characters">
  17. <caption>Defined Unicode characters 165&ndash;172</caption>
  18. <thead>
  19. <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>
  20.  
  21. </thead>
  22. <tbody>"""
  23.  
  24. for char in range(start,end+1):
  25.     name = unicodedata.name(unichr(char), "undefined")
  26.     print "<tr><td class=\"num\">" + str(char) + "</td>"
  27.     print "<td><code class=\"html\">&amp;#" + str(char) + ";</code>"
  28.     print "</td><td class=\"char\"><span>&#" + str(char) + ";</span></td>"
  29.     print "<td class=\"name\">" + name + "</td></tr>"
  30.  
  31. print "</tbody></table>"
  32. print "</body></html>"
  33.  
can anyone help with this?
Nov 15 '08 #1
Share this Question
Share on Google+
1 Reply


bvdet
Expert Mod 2.5K+
P: 2,851
I don't see a problem with the import. cgi.FieldStorage() is available on my system upon import. What does dir(cgi) show?
Nov 15 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.