2017-06-15 88 views
0

此命令生成的Python 3兼容的代碼生成python2代碼:如何通過阿帕奇節儉

thrift -r -gen py temp.thrift 

然後我嘗試:

thrift -r -gen py3 temp.thrift 

,但不工作。

+0

正如一個旁註:一個錯誤描述只包含「*它不起作用*」[沒有任何進一步的細節](http://www.catb.org/esr/faqs/smart-questions.html#beprecise )是不夠的**,並且傾向於受到歡迎,關閉,低估和其他不好的事情。這浪費了我們的時間,也浪費了你的時間。 – JensG

回答

1

的命令行幫助揭示了所有選項:

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。