Hello I am writing an addon to ease the addon development with Emacs(and other editors... when it works well) and Blender. The goal isto make Blender reload the addon on saving.

I use ipv4, TCP sockets for IPC. I had to fork a process from blender for the socket communication, because I could not close the socket any other way, the reason: I do not know a way to make a handler for closing in Blender (however it would be very handy).

With the child process I worked around it, when Blender (parent) terminates, the init process (pid = 1) will "adopt" the child, which can be detected with os.getppid(). It works now, but It has a side effect: Blender can not be closed from the GUI, but with SIGTERM. It is funny becuse blender is the most badass software when it comes to closing :) .

My questions: 1. Why is this hapenning? 2. Are there any more suitable ways for IPC or socket closing?

I use 2.76b offical build on Gentoo Linux(kernel version 3.18.12)

I am not an expert programmer so maybe I miss something important


Well, I solved it with daemonizing the child process.

class serverProcess(mp.Process):
    def __init__(self, port=9012, timeout=5.0, host=socket.gethostname(), daemon=True):
        mp.Process.__init__(self, daemon=daemon)
        self.port = port
        self.timeout = timeout
        self.host = host

# many other stuff

RPCserverProcess = serverProcess(port=9010, timeout=3.0)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.