[英]How generate python 3 compatible code by apache thrift
This command generates python2 code:此命令生成 python2 代码:
thrift -r -gen py temp.thrift
Then I tried:然后我尝试:
thrift -r -gen py3 temp.thrift
but that is not working.但这不起作用。
The command line help reveals all options:命令行帮助显示所有选项:
thrift --help
These are all available python-related options available in master today:这些都是今天在 master 中可用的与 python 相关的选项:
py (Python):
twisted: Generate Twisted-friendly RPC services.
tornado: Generate code for use with Tornado.
no_utf8strings: Do not Encode/decode strings using utf8 in the generated code. Basically no effect for Python 3.
coding=CODING: Add file encoding declare in generated file.
slots: Generate code using slots for instance members.
dynamic: Generate dynamic code, less code generated but slower.
dynbase=CLS Derive generated classes from class CLS instead of TBase.
dynfrozen=CLS Derive generated immutable classes from class CLS instead of TFrozenBase.
dynexc=CLS Derive generated exceptions from CLS instead of TExceptionBase.
dynimport='from foo.bar import CLS'
Add an import line to generated code to find the dynbase class.
package_prefix='top.package.'
Package prefix for generated files.
old_style: Deprecated. Generate old-style classes.
According to THRIFT-1857 , py 3 is available starting at 0.10.0.根据THRIFT-1857 ,py 3 从 0.10.0 开始可用。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.