0
此命令生成的Python 3兼容的代码生成python2代码:如何通过阿帕奇节俭
thrift -r -gen py temp.thrift
然后我尝试:
thrift -r -gen py3 temp.thrift
,但不工作。
此命令生成的Python 3兼容的代码生成python2代码:如何通过阿帕奇节俭
thrift -r -gen py temp.thrift
然后我尝试:
thrift -r -gen py3 temp.thrift
,但不工作。
的命令行帮助揭示了所有选项:
thrift --help
这些都是高手当今所有可用的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.
据THRIFT-1857,PY 3应开始可用0.9。
正如一个旁注:一个错误描述只包含“*它不起作用*”[没有任何进一步的细节](http://www.catb.org/esr/faqs/smart-questions.html#beprecise )是不够的**,并且倾向于受到欢迎,关闭,低估和其他不好的事情。这浪费了我们的时间,也浪费了你的时间。 – JensG