Qprocess subprocess.completed signal not triggering PySide6

34 Views Asked by At

I have a Pyside6 app that is supposed to run a subprocess as part of it's functioning. When the subprocess finishes it is supposed to trigger the signal self.subprocess.finished, but the function notify_success_or_failure is not being run, even after the process finishes.

this is my code

    def begin_subprocess(self, folder_path, return_to_path, return_path):
        self.subprocess = QProcess()
        # check what command needs to be run to start the subprocess
        python_executable = sys.executable

        # gather the parameters needed
        paramaters = [folder_path, str(return_to_path), return_path]
        command_info = [python_executable, "./true_run.py"]
        command = command_info + paramaters

        print(command)
        
        # Connect the finished signal of the QProcess to the custom signal
        self.subprocess.finished.connect(self.notify_success_or_failure)
        
        # Start the subprocess asynchronously
        self.subprocess.startDetached(command[0], command[1:])

I would like to be able to say I have tried a few things, but I haven't been able to. I have no clue what is causing the problem, probobly a lack of know-how, if someone here knows more than me about pyside that would be much appreciated.

1

There are 1 best solutions below

0
callen44 On

Apparently, I was using the wrong kind of start method, I made the mistake of thinking that startDetached would start it in the terminal and allow the user to interact with the program (which it does on the side). in the end, it turns out that startDetatched disabled signals, thanks musicamante.