Search code examples
pythonscalainterprocess

Inter-process communication between Python and Scala programs


I have a website that is backed by CherryPy web framework and a scala program that runs on a same machine and contains an actor system inside. OS is Ubuntu 12.04.

What I want is this: once user fills out and submits a form I send the data from CherryPy backend to scala program as a JSON string. How can this be done? What should I use in my python and scala programs to implement this functionality?


Solution

  • As you are on a *nix system, you may want to look into Unix domain sockets (that link contains a very clear example use).

    You can use the python socket module to easily create a Unix socket using:

    import socket
    sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)