cannot concatenate ‘str’ and ‘NoneType’ objects

The cause of this error may run deep in your code, but if you simply wish to have and error free interface on the front end, you can cast any NoneType object to an empty string:

str(myVar)

'this demonstrates casting a none to a string' + str(couldBeANoneType)

Subscribe

  • RSS Feed for Posts


This entry was posted in Python. Bookmark the permalink.

Updated: 2011-09-23

Phil LaNasa

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <font color="" face="" size=""> <span style="">