TypeError: "unicode" has no buffer interface
You have a string unicode
. You are trying to call a function that requires types str
-like ( str
, bytearray
, everything that supports the buffer interface). Thus, you get an error, just like if you tried to call a function that requires numeric types.
Most likely the problem is that you need (a): encode
your unicode
- str
, or (b) need to call a function that takes unicode
instead str
. But without seeing your code, it is very difficult to give a more specific answer.
I can give you two general tips that might help:
-
Read the Unicode HOWTO . If you don't understand this, ask for help and keep reading until you understand all this and the answer to this question is obvious.
-
Use Python 3.x instead of 2.x. It won't magically solve all of your problems, but you will generally have fewer problems mixing-Unicode and non-Unicode strings, and they will tend to be more obvious (mainly because you tend to deal only with Unicode Strings).
source to share