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

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

P: 1
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>')


Expand|Select|Wrap|Line Numbers
  1. Traceback (most recent call last):
  2.   File "D:\Program Files\Google\google_appengine\google\appengine\ext\webapp\", line 515, in __call__
  4.   File "D:\Documents and Settings\purnachandra\Desktop\duplicate\", 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
Share this Question
Share on Google+
2 Replies

Expert 5K+
P: 6,050

Expert Mod 2.5K+
P: 2,851
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

Post your reply

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