[erlang-questions] Tutorial (Erlang / Python)

zxq9 zxq9@REDACTED
Wed Sep 13 09:07:04 CEST 2017


On 2017年09月13日 水曜日 08:42:27 Walter Weinmann wrote:
> What is the idea behind the examples in the tutorial? Should these be
> executable or are they just non-executable program code patterns. I want to
> use Apache Thrift to connect Erlang and Python, but I am struggling with
> connection problems from Erlang Client to Python Server (see THRIFT-4312
> <https://issues.apache.org/jira/browse/THRIFT-4312> or Apache Thrift
> mailing list
> <http://mail-archives.apache.org/mod_mbox/thrift-user/201709.mbox/<CACe_jXefCS6pR-6YoZ6nMNU4y89KDiu2cnFi3dj6k%2BPpGaBrfQ%40mail.gmail.com>>).
> Since the community is very quiet here, I'm afraid this is a much too
> exotic combination for Apache Thrift. Any comments?

I'm not familiar with Apache Thrift. Normally when I want Python and Erlang to talk to one another I use BERT over a socket (usually network socket, but anything works). But that is just old-fashioned socket programming.

Looking at the docs for Thrift[1] it looks like there is supposed to be something like a Thrift compiler that builds an Erlang (and Python and whatever else) module for you that you should be invoking. I assume that is the `thrift_client` module you are invoking in your program.

The error you are seeing there with {error, econnrefused} is a normal TCP network error, not a specific Thrift/Erlang problem -- so check that the service you're trying to connect to is running and the port you're trying to contact is open.

It seems very odd that the return value of `thrift_client:call/2` is being assigned to `Client1,2,3`. Are you sure the return value is supposed to look like this? Once you get the network problem sorted out, give that part a look -- I imagine that's actually supposed to always match the original Client (so that maybe you could open several connections at once, and match on them in a larger `receive` or `case` clause.

-Craig

[1] It looks like your formatting for Jira got sort of crazy at some point, so its a little hard to tell how things were supposed to be formatted. Pasting your example in a paste bin or here in the mailing list could be helpful.



More information about the erlang-questions mailing list