26

What's the best way to integrate Erlang and python?

We need to call python functions in Erlang and call Erlang functions in python. At this moment we are trying to use SOAP as a intermediate layer between these two languages, but we have a lot of "not compatible" troubles. Could you advise the best way to perform integration?

Tofu
  • 199
  • 2
  • 12
OJ287
  • 734
  • 1
  • 7
  • 15
  • 4
    Could you be more specific on what you're trying to integrate and what your "not compatible" troubles are? If you're using SOAP or XML-RPC as an intermediate layer, what are the problems you're experiencing there? Details, man!! – jathanism Oct 21 '10 at 18:23
  • 1
    Maybe you want to look at https://launchpad.net/twotp – rubik Oct 21 '10 at 18:29
  • 1
    "best" is undefined in your question. Do you mean "cheapest"? Do you mean "Most use of IBM Technology"? Do you mean "requires the most hardware"? What do you mean by best? – S.Lott Oct 21 '10 at 21:23

2 Answers2

26

As already mentioned with erlport you can use Erlang port protocol and term_to_binary/binary_to_term functions on Erlang side. On Python side there are low level port driver Port which can send and receive messages from Erlang and more high level protocol handler Protocol which simplified situation when you want to call a Python function from Erlang. Currently there are no any auxiliary interfaces on Erlang side but it's possible there will be some in the future. In the examples directory you can find some example code for different situations.

And feel free to contact me about any ErlPort related topic.

hdima
  • 3,627
  • 1
  • 19
  • 19
  • 1
    Wow, the man himself! Thanks to you (and to your collaborators) for a great library. – Muhammad Alkarouri Oct 21 '10 at 21:16
  • the python links are dead, it looks like they have been moved to `erlport / priv / python3 / erlport /` – Foo Bar User Apr 14 '14 at 00:20
  • @FooBarUser With the new ErlPort version it's actually much easier now. Please check http://erlport.org/docs/python.html for more details. – hdima Apr 14 '14 at 09:10
  • thank you, im a bit concerned about the alpha status but will give it a try for fun. – Foo Bar User Apr 15 '14 at 01:40
  • 1
    @FooBarUser It's in alpha because I still want to add some functions to the API. Currently there are only two bug reports open (the other two are feature requests) which I want to fix soon so I consider it stable enough. – hdima Apr 15 '14 at 07:26
  • As far as I understand, erlport is dead. Are there any replacement to it? – DYZ Nov 07 '22 at 06:24
11

In my experience, the best is erlport.

It allows you to build an Erlang port in Python by satisfying the Erlang port protocol. It handles the data compatibility issue by implementing the Erlang external term format. The linked page shows a clear example of how to use it.

Muhammad Alkarouri
  • 23,884
  • 19
  • 66
  • 101