thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Nelson <jtnels...@gmail.com>
Subject Support for Python3
Date Sun, 01 Nov 2015 22:23:44 GMT
Hi,

I recently upgraded a project to use Python3 and am now getting errors from
Thrift. The error is TypeError: string argument expected, got 'bytes' and
the stack trace is

...
    self._oprot.writeMessageBegin('login', TMessageType.CALL, self._seqid)
  File
"/Users/jnelson/.pyenv/versions/3.3.6/lib/python3.3/site-packages/thrift/protocol/TBinaryProtocol.py",
line 46, in writeMessageBegin
    self.writeI32(TBinaryProtocol.VERSION_1 | type)
  File
"/Users/jnelson/.pyenv/versions/3.3.6/lib/python3.3/site-packages/thrift/protocol/TBinaryProtocol.py",
line 111, in writeI32
    self.trans.write(buff)
  File
"/Users/jnelson/.pyenv/versions/3.3.6/lib/python3.3/site-packages/thrift/transport/TTransport.py",
line 168, in write
    raise e
  File
"/Users/jnelson/.pyenv/versions/3.3.6/lib/python3.3/site-packages/thrift/transport/TTransport.py",
line 164, in write
    self.__wbuf.write(buf)

Trying to figure out if Python3 is supported by Thrift is giving me
conflicting answers. The Jira
<https://issues.apache.org/jira/browse/THRIFT-1857> for the issue is still
open, but comments on StackOverflow
<http://stackoverflow.com/questions/32229690/apache-thrift-python-3-support>
suggest
that support arrived with the 0.9.3 release (but I'm still getting the
error after upgrading the Python Thrift library to 0.9.3).

In any case. I'm not a Python export, but it seems to me that this issue is
happening because __wbuf is an instance of StringIO, as opposed to BytesIO
<http://stackoverflow.com/questions/6479100/python-stringio-replacement-that-works-with-bytes-instead-of-strings>
.

So, is Python3 supported at this point, and if not, what is the plan for
adding it?

Thanks,
Jeff

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message