I m trying to fire a subprocess.Popen to check if any substance Painter is still runnning using the windows tasklist command for that.
from subprocess import Popen, PIPE import re def get_current_pids(self, *args, **kwargs): cmd = 'tasklist /FI "IMAGENAME eq Substance Painter.exe" 2>NUL | find /I /N "Substance Painter.exe"' regex = re.compile(" (?P<pid>[0-9]+) Console") proc = Popen(cmd, shell=True, stdout=PIPE, stderr=PIPE) data, err = proc.communicate() exit_code = proc.poll() if exit_code: return  pids =  .... # process the response to extract the painters process ids return pids
tk-substancepainter has a register_events_callback
so i added a callback engine.register_events_callback(“QUIT”, self._on_quit) in the hook override engine_init.py , class EngineInit(Hook)
so when painter quits, _on_quit is run and calls get_current_pids
the method _on_quit is correctly called and get_current_pids as well but stops
as soon as the code reach proc.communicate , (the code runs fine is a non SG env)
Not sure whats happening. no error raised neither