Изглежда, че не разбирам нещо за 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
>>>