TypeError: "unicode" has no buffer interface

Please tell me how to fix this. I got this error:

TypeError: 'unicode' does not have the buffer interface

      

+3


source to share


2 answers


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).

+9


source


Since there is a flask. There was an error in this error message werkzeug

. So update to the latest version and you should be fine.



0


source







All Articles