473,396 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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.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
1 1932
bvdet
2,851 Expert Mod 2GB
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

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

Similar topics

0
by: seth | last post by:
Last week I encountered an AttributeError in my unit tests that I wasn'table to catch with an "except AttributeError" statement. The problem stemmed from a class that raised an error inside...
5
by: Reinhard Koenig | last post by:
Hello, I' m using Python 2.3, win32all-157 under W2K. I've applied the makepy utility for the Word 8.0 object library. I now receive: Python 2.3.1 (#47, Sep 23 2003, 23:47:32) on win32 Type...
2
by: GrelEns | last post by:
hello, i would like if this behaviour can be obtained from python : trap an attributeError from inside a subclassing dict class... (here is a silly examples to explain my question) class...
0
by: Erlend Fuglum | last post by:
I have tried and tried, but cannot figure out the source of the following error: AttributeError: 'module' object has no attribute 'menyHMTL' __doc__ = 'Attribute not found.' __getitem__ =...
2
by: rsd | last post by:
Hi, I'm trying get Samsung YH-920 mp3 player to work with Debian GNU/Linux. To do that I need to run http://www.paul.sladen.org/toys/samsung-yh-925/yh-925-db-0.1.py script, the idea behind the...
7
by: erikcw | last post by:
Hi, I'm trying to build a SQL string sql = """INSERT INTO ag ('cid', 'ag', 'test') VALUES(%i, %s, %d)""", (cid, ag, self.data) It raises this error: AttributeError: 'tuple' object has no...
2
by: Thomas Guettler | last post by:
Hi, how can you list the attributes of an object if you catch an AttributeError? I couldn't find a reference in the exception object, which points to the object. I want to call dir() on...
0
by: noroi | last post by:
Hi, I got problems while running Eric Blossom's FM receiver's example codes from the GNURadio tutorial page; the RF front end reads the signal input from daughter board, and when the compiler...
3
by: Juha S. | last post by:
I'm getting a "AttributeError: 'module' object has no attribute 'clock'" when importing a module from within two packages related to the line: "self.lastTime = time.clock()" in the __init__() of...
4
by: Nikhil | last post by:
I have recently written a small module. When I import the module, I always get the error only when I do -- Traceback (most recent call last): File "<stdin>", line 1, in <module>
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.