Popular recipes by thanos vassilakis http://code.activestate.com/recipes/users/4048784/2010-02-18T06:47:09-08:00ActiveState Code RecipesAn Erlang Port in Python (Python)
2010-02-18T06:47:09-08:00thanos vassilakishttp://code.activestate.com/recipes/users/4048784/http://code.activestate.com/recipes/534162-an-erlang-port-in-python/
<p style="color: grey">
Python
recipe 534162
by <a href="/recipes/users/4048784/">thanos vassilakis</a>
(<a href="/recipes/tags/distributed/">distributed</a>, <a href="/recipes/tags/erlang/">erlang</a>, <a href="/recipes/tags/integration/">integration</a>, <a href="/recipes/tags/process/">process</a>).
Revision 3.
</p>
<p>Erlang has two built-in interoperability mechanisms. One is distributed Erlang nodes and the other one is ports.
Ports provide the basic Erlang mechanism for communication with the external world. They provide a byte-oriented interface to an external program. When a port has been created, Erlang can communicate with it by sending and receiving lists of bytes. This recipe cooks an Erlang port in python. Making it easy for Erlang to instantiate and use python objects. Like most simple port implementations it uses an external python program and lets Erlang communicate via standard input and write to standard output. Theoretically, the external program could be written in any programming language. This recipe is pretty abstract and you will have to implement your own encode and decoding scheme.</p>