pythonguis / feedback

Corrections & suggestions for Python GUIs tutorials on pythonguis.com
1 stars 0 forks source link

Starting QProcess multiple times #6

Open Patlax opened 8 months ago

Patlax commented 8 months ago

When executing a deployed pyside6-application, which starts a QProcess, the app crashes after two or three runs, without any debug information or error code. When this app is executed from Qt (run, and also debug-mode), this does not happen. Also, using delete later on self.process did not solve the issue. The app has basically the same structure as the example you provided. The deployed app was tested on Windows 11 as well as Windows 10 16.7 using Python3.11. How would you get rid of the old QProcess?

Error: process terminated with exit code 3221225477, exit code 0xC0000005 (Access Violation)

''' class ProcessManager(QWidget): def init(self): super().init() self.process = None

def start_process(self, args,main_py):
    args_json = json.dumps(args)
    self.process = QProcess()
     self.process.started.connect(self.handle_process_start)
     self.process.finished.connect(self.handle_process_finish)
     if self.process.state() == QProcess.NotRunning:
            python_interpreter = "C://Program Files//Python311//python.exe"
            self.process.start(python_interpreter, [main_py, args_json])

def handle_process_start(self):
    self.print_to_console.emit('success', 'Process is running. Please wait..')
    self.update_status_signal.emit('success', 'Process is running')

def handle_process_finish(self):
    self.process.setArguments([])

'''