You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by Tim Sell <tr...@gmail.com> on 2008/07/09 22:16:50 UTC

[thrift] Getting the tutorial to run

2008/7/9 Andrew Toulouse <an...@atoulou.se>:
> I'm trying to get started, but the total lack of hand-holding at the
> beginning is seriously getting me down. The README only goes as far as
> editing the code, and says nothing about how to actually *run* the thing.
>
> tutorial.thrift worked fine, but now I have gen-py with empty __init__.py,
> shared, and tutorial. Running anything from the gen-py/tutorial directory
> fails, since shared is a directory above, so I have to create a symlink in
> order for import shared.SharedService to work by running the
> Calculator-remote command (not that I know what to run to just do a hello
> world test). I suspect that I'm doing something wrong.
>
> I know the readme says it's intentionally brief, but would it hurt to have a
> simple start-to-finish Hello World! example?
>
> _______________________________________________
> thrift mailing list
> thrift@publists.facebook.com
> http://publists.facebook.com/mailman/listinfo/thrift
>
>

The gen-py directory is created by running
tutorial.thrift
which is executable (or by thrift -py tutorial.thrift).
You don't actually run anything inside gen-py, you just import the
things in there and use them to build your service or use them in a
client. The point of thrift is you automatically generate a bunch of
native interfaces in multiple languages from one .thrift file.

Have a look at the <projectroot>/tutorial/py directory.
That contains the example of a python server which implements the
thrift service described in tutorial.thrift, it also contains an
example client which uses the service.

To see what makes thrift great for example, start the
tutorial/py/PythonServer.py, and use the php client in
tutorial/php/PhpClient.php

Does that make sense?

~Tim