1
我似乎對Apache Thrift有些誤解。我已經使用tutorial.thrift文件安裝並生成了python綁定。我操縱了我的PYTHONPATH
環境變量以允許從生成的文件導入。當我導入tutorial.Calculator' it can't find
shared.SharedService`。這是Apache Thrift的依賴關係還是我必須定義的東西?無法在節儉教程中導入shared.SharedService
[email protected]:~/tmp$ export PYTHONPATH=$PYTHON:`pwd`/gen-py
[email protected]:~/tmp$ echo $PYTHONPATH
:/home/ericu/tmp/gen-py
[email protected]:~/tmp$ c
c: command not found
[email protected]:~/tmp$ cd
[email protected]:~$ pyhon
No command 'pyhon' found, did you mean:
Command 'python' from package 'python-minimal' (main)
pyhon: command not found
[email protected]:~$ python
Python 2.7.5 Stackless 3.1b3 060516 (default, Sep 23 2013, 20:17:03)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import tutorial
>>> tutorial.Calculator
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'Calculator'
>>> import tutorial.Calculator
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ericu/tmp/gen-py/tutorial/Calculator.py", line 10, in <module>
import shared.SharedService
ImportError: No module named shared.SharedService
>>>
感謝您的澄清。 –
供參考:教程頁面已更新。 – JensG