You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@thrift.apache.org by David Reiss <dr...@facebook.com> on 2009/02/03 22:38:49 UTC
Re: thrift --gen py: namespace issues
Sorry it took so long to respond to this.
These issues are being tracked at
https://issues.apache.org/jira/browse/THRIFT-256
https://issues.apache.org/jira/browse/THRIFT-310
They should be resolved soon.
David Eisenstat wrote:
> $ 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