Hi Matthieu On Saturday 04 July 2009 07:10:56 Matthieu Imbert wrote: > I tried to generate both the default service and the twisted one in > separate directories: ./gen-py and ./gen-py-twisted, and have my server > import from ./gen-py-twisted and the clients import from ./gen-py, but > it's not a working solution since i also have service modules, both > imported from the client and the server, that perform conversions > between thrift structures and application specific structures. This > modules need to import either from ./gen-py-twisted or ./gen-py, but in > any case, at some point, this results in an incoherence in the imports > (eg: the client imports ./gen-py and imports the service module which > itself imports from ./gen-py-twisted)
Just move your service modules to another directory, and import them from both the client and the server. However, I think the Thrift compiler should write the Twisted stuff to another directory (e.g. gen-py.twisted), I believe your case (standard Python and Twisted code in the same project) is fairly common. What do others think? Anyway, I attached and uploaded an example based on the one from the tutorial to: http://fluidinfo.com/esteve/stuff/txthrift_client.py http://fluidinfo.com/esteve/stuff/txthrift_server.py > By the way, thanks all the thrift team for the great software, and > Esteve for the twisted stuff. Let us know if the above solution works for you and don't hesitate to share with us any issue you find :-) Cheers.
txthrift_client.py
Description: application/python
txthrift_server.py
Description: application/python
