473,473 Members | 1,882 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

TypeError: cannot concatenate 'str' and 'NoneType' objects

1 New Member
Expand|Select|Wrap|Line Numbers
  1. for district in query:
  2.             self.response.out.write('<tr><td bgcolor="#ffffff" style="font-family:arial;font-size:12px">')
  3.             self.response.out.write(district.Dis_Id)
  4.             self.response.out.write('</td><td bgcolor="#ffffff" style="font-family:arial;font-size:12px">')
  5.             self.response.out.write(district.Dis_Name)
  6.             self.response.out.write('</td><td bgcolor="#ffffff" style="font-family:arial;font-size:12px"><a href="#"onclick="editdistrict(\''+district.Dis_Id+'\');">Edit</a>/<a href="#"onclick="districtdelete(\''+district.Dis_Id+'\');">Delete</a>')

Error:::

Expand|Select|Wrap|Line Numbers
  1. Traceback (most recent call last):
  2.   File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\__init__.py", line 515, in __call__
  3.     handler.post(*groups)
  4.   File "D:\Documents and Settings\purnachandra\Desktop\duplicate\cyberabadpolice.py", line 1102, in post
  5.     self.response.out.write('</td><td bgcolor="#ffffff" style="font-family:arial;font-size:12px"><a href="#"onclick="editdistrict(\''+district.Dis_Id+'\');">Edit</a>/<a href="#"onclick="districtdelete(\''+district.Dis_Id+'\');">Delete</a>')
  6. TypeError: cannot concatenate 'str' and 'NoneType' objects
Sep 20 '10 #1
2 1586
Markus
6,050 Recognized Expert Expert
Please see: http://bytes.com/topic/python/answer...netype-objects
Sep 20 '10 #2
bvdet
2,851 Recognized Expert Moderator Specialist
Apparently the district attribute Dis_Id has no value. The NoneType object is accessed through the built-in name None. Test for a value before attempting the string addition to avoid the error.
Sep 20 '10 #3

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

Similar topics

8
by: digitalorganics | last post by:
What are the reason one would get this error: TypeError: Cannot create a consistent method resolution order (MRO) for bases object ?? I can provide the code if needed....
9
by: thompson.marisa | last post by:
Hi. I'm extremely new to Python and programming as a whole. I have written a python script with the assistance of ESRI ArcGIS 9.2, which uses Python 2.4.1, however, it gives me this error when...
1
by: kgk | last post by:
I would like to concatenate several file-like objects to create a single file-like object. I've looked at fileinput, however this returns a fileinput object that is not very file-like. ...
1
by: Alexander Tuchacek | last post by:
hallo, i try to adress an qt object self.statusbar.showMessage("rtt %s...." % (n.rtt)) in an callback function, comming from a shared lib importet by ctypes, on osx this works wonderfull ...
5
by: Marc Oldenhof | last post by:
Hello all, I'm pretty new to Python, but use it a lot lately. I'm getting a crazy error trying to do operations on a string list after importing numpy. Minimal example: Python 2.5.1...
10
by: est | last post by:
>>import md5 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python25\lib\pickle.py", line 1366, in dumps Pickler(file, protocol).dump(obj) File...
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
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.