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

  • follow us in feedly


This entry was posted in Python. Bookmark the permalink.

Updated: 2011-09-23

Phil LaNasa