Кажется, я что-то неправильно понимаю в Apache Thrift. Я установил и сгенерировал привязки Python, используя файл tutorial.thrift. Я манипулировал своей переменной окружения PYTHONPATH
, чтобы разрешить импорт из сгенерированных файлов. Когда я импортирую tutorial.Calculator' it can't find
shared.SharedService`. Это зависимость от Apache Thrift или что-то, что я должен определить?
ericu@eric-phenom-linux:~/tmp$ export PYTHONPATH=$PYTHON:`pwd`/gen-py
ericu@eric-phenom-linux:~/tmp$ echo $PYTHONPATH
:/home/ericu/tmp/gen-py
ericu@eric-phenom-linux:~/tmp$ c
c: command not found
ericu@eric-phenom-linux:~/tmp$ cd
ericu@eric-phenom-linux:~$ pyhon
No command 'pyhon' found, did you mean:
Command 'python' from package 'python-minimal' (main)
pyhon: command not found
ericu@eric-phenom-linux:~$ 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
>>>