Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I call erlang from Python? [duplicate]

Tags:

python

erlang

Possible Duplicate:
best way to integrate erlang and python

To use some powerful features of erlang, I should call erlang program from Python, How can I do that? Thank you~

like image 416
Suge Avatar asked Dec 13 '10 03:12

Suge


3 Answers

In Erlang , you can communicate with the external world using ports which provides a byte oriented interface to the external program.

You can also have a look at erlport which is a python library implementing the Erlang port protocol.

like image 182
Arunmu Avatar answered Nov 20 '22 20:11

Arunmu


Take a look at BERT-RPC. It allows you to perform remote procedure calls and casts, request data (including streaming). There you'll find various libraries for some languages including Python.

In your case you might just set up erlang server using ernie and communicate with it via python-bertrpc client. Both projects are documented.

like image 3
YasirA Avatar answered Nov 20 '22 19:11

YasirA


We mostly use JSON over HTTP to do this. In some cases you might want to use a more robust messaging protocol (e.g. AMQP with RabbitMQ), but there's rarely a good reason for Python to directly speak the Erlang distribution protocol. Sometimes we use erlport to serialize things instead of JSON, when performance is a little more important.

like image 1
YOUR ARGUMENT IS VALID Avatar answered Nov 20 '22 21:11

YOUR ARGUMENT IS VALID