title: How can I execute my script and print it in the GUI in PYQT5?
body: <p>I am not sure if the path to the practice2.py script is correct. How would I format the path</p>
  
  <pre><code>@QtCore.pyqtSlot()
      def on_pushButtonPrint_clicked(self):
          cmd = '**user/hugo caldeira/desktop/python/practice2.py**' 
  </code></pre>
  
  <p>This is the path that I would normally use to execute the script through the terminal.</p>
  
  <p>This is the error I keep getting</p>
  
  <pre><code>users: extra operand ‘caldeira/desktop/python/practice2.py’
  Try 'users --help' for more information.
  Traceback (most recent call last):
    File "windowWaction.py", line 36, in on_pushButtonPrint_clicked
      output = subprocess.check_output(cmd, shell=True)
    File "C:\Users\Hugo Caldeira\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 336, in check_output
      **kwargs).stdout
    File "C:\Users\Hugo Caldeira\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 418, in run
      output=stdout, stderr=stderr)
  subprocess.CalledProcessError: Command 'users/hugo caldeira/desktop/python/practice2.py' returned non-zero exit status 1.
  </code></pre>
  
  <hr>
  
  <pre><code>import sys
  import os
  import subprocess
  from PyQt5 import QtCore, QtGui, QtWidgets
  from PyQt5.QtWidgets import QWidget, QApplication
  
  
  class MyStream(QtCore.QObject):
      message = QtCore.pyqtSignal(str)
      def __init__(self, parent=None):
          super(MyStream, self).__init__(parent)
  
      def write(self, message):
          self.message.emit(str(message))
  
  class MyWindow(QtWidgets.QWidget):
      def __init__(self, parent=None):
          super(MyWindow, self).__init__(parent)
  
          self.pushButtonPrint = QtWidgets.QPushButton(self)
          self.pushButtonPrint.setText("Click Me!")
  
          self.pushButtonPrint.clicked.connect(self.on_pushButtonPrint_clicked)
  
          self.textEdit = QtWidgets.QTextEdit(self)
  
          self.layoutVertical = QtWidgets.QVBoxLayout(self)
          self.layoutVertical.addWidget(self.pushButtonPrint)
          self.layoutVertical.addWidget(self.textEdit)
  
      @QtCore.pyqtSlot()
      def on_pushButtonPrint_clicked(self):
          cmd = 'user/hugo caldeira/desktop/python/practice2.py'
  
          # execute script
          output = subprocess.check_output(cmd, shell=True)
          print (output)
  
      @QtCore.pyqtSlot(str)
      def on_myStream_message(self, message):
          self.textEdit.moveCursor(QtGui.QTextCursor.End)
          self.textEdit.insertPlainText(message)
  
  if __name__ == "__main__":
      import sys
  
      app = QtWidgets.QApplication(sys.argv)
      app.setApplicationName('MyWindow')
  
      main = MyWindow()
      main.show()
  
      myStream = MyStream()
      myStream.message.connect(main.on_myStream_message)
  
      sys.stdout = myStream
      sys.exit(app.exec_())
  </code></pre>