Trying to make a small example on how to do IPC with Elisp using Python for the server. My source of information is this Here is the code I have right now.
(let ((process-connection-type nil) (arguments (list "./server.py"))) (apply 'start-process "my-process" "*my-process-buffer*" "python" arguments) (set-process-filter (get-process "my-process") 'my-callback)) (defun my-callback (process msg) (message msg)) (defun kill-my-process () (interactive) (delete-process "my-process")) (defun send-to-my-process (msg) (interactive "sEnter message: ") (process-send-string "my-process" (concat msg "\n"))) (provide my-process)
import sys sys.stdout.write("STARTING MY PROCESS!") sys.stdout.flush() for line in sys.stdin: sys.stdout.write(line) sys.stdout.flush()
The problem I have is that the process starts ok, but I can only see "STARTING MY PROCESS!" printed nothing when I do
My question is, what do I need to change in order for messaging to work in the above example?
Update: Added suggested fixes.