Skip to content

hamano/python-erlang-interface

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

PyErl

PyPI Build Status GitHub license

PyErl is Erlang Interface for Python. which help you integrate programs written in Python and Erlang.

DEPENDENCIES

This module requires these other modules and libraries:

Erlang/OTP R12 or later

In debian:

apt-get install erlang-dev

INSTALL

python setup.py build
python setup.py install

EXAMPLE

  • make erlang terms
import pyerl
atom = pyerl.mk_atom("hello")
string = pyerl.mk_string("world")
int = pyerl.mk_int(-1)
list = pyerl.mk_list([atom, string, int])
print list
  • call rpc
# just call pingpong:ping() in node2@localhost
import pyerl
host = "localhost"
name = "node1"
node = name + "@" + host
cookie = "TESTCOOKIE"
pyerl.connect_xinit(host, name, node, "127.0.0.1", cookie, 1)
pyerl.xconnect("127.0.0.1", "node2")
atom = pyerl.mk_atom("ping")
args = pyerl.mk_list([atom]);
eterm = pyerl.rpc(sock, "pingpong", "ping", args);
pyerl.close_connection(sock);
print eterm

AUTHER

Tsukasa Hamano code@cuspy.org