TypeError: 'unicode' does not have the buffer interface [closed] TypeError: 'unicode' does not have the buffer interface [closed] flask flask

TypeError: 'unicode' does not have the buffer interface [closed]


You've got a unicode string. You're trying to call a function that requires str-like types (str, bytearray, anything else that supports the buffer interface). So you get an error, just like you'd get if you tried to call a function that required number-like types.

Most likely the problem is that you either (a) need to encode your unicode to str, or (b) need to call a function that takes unicode instead of str. But without seeing any of your code, it's very hard to give a more specific answer.

I can give you two general pieces of advice that might help:

  1. Read the Unicode HOWTO. If you don't understand it, ask for help, and keep reading until you understand the whole thing, and the answer to this question is obvious.

  2. Use Python 3.x instead of 2.x. It won't magically solve all of your problems, but you'll generally have fewer mixing-Unicode-and-non-Unicode-strings problems, and they'll generally be more obvious (mainly because you'll generally only be dealing with Unicode strings).


Since there is a flask tag. There was a bug in werkzeug with this error message. So update to the newest version and you should be fine.