[daily development record] pycurl Python 3 error (23),’failed writing body (0= 456)

Explain the function of static keyword and final keyword in Java in detail>>>

TypeError: string argument expected, got ‘bytes’
error(23, ‘Failed writing body (0 != 456)’)

If the above error is reported, it is caused by the following code

buff = StringIO()
self.curl.setopt(pycurl.WRITEFUNCTION, buff.write)

Note that the package path of stringio () in Python 3 is Io. Stringio

Change the above stringio() to:

buff = BytesIO()
self.curl.setopt(pycurl.WRITEFUNCTION, buff.write)

Similarly, the package path of bytesio() is Io. Bytesio

Similar Posts: