$ cat foo.thrift
service Foo {
void foo()
}
service Bar extends Foo {
void bar()
}
$ thrift --gen py foo.thrift
$ cd gen-py
$ python
Python 2.5.1 (r251:54863, Apr 15 2008, 22:57:26)
[GCC 4.0.1 (Apple Inc. build 5465)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import foo.Bar
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "foo/Bar.py", line 19, in <module>
class Iface(Foo.Iface):
NameError: name 'Foo' is not defined
This is the essence of a problem I had with the Thrift spec from a
Facebook puzzle:
http://www.facebook.com/jobs_puzzles/bag_banner.thrift (I myself have
been using thrift for about a day.)
In addition, if Foo has no methods, the generated code does not have
the "pass" statement required by Python for an empty class.
-David