title: How to print output of external script to PyQt gui Window without extra "/n" characters
body: <p>I am trying to print the output of a called script to the window of a PyQt5 gui.  I have been able to successfully use subprocess to get the script to execute the called script, but it is printing the characters "/n" between each print statement in the called script.</p>
  
  <p><strong>ex:  b'stuffz\nhere is another linet\ncool!\nhello worldt!\n\n\nWhat what?\nWhat what?\nWhat what?\nWhat what?\n'</strong></p>
  
  <p>Can anyone help me figure out how to get my code to simply display the called script output (hellworld_final.py) in the exact format that it would display if I ran it directly? </p>
  
  <p>Or, if anyone has a better method for calling an external script and displaying the output of the script as text in the PyQt gui, I would greatly appreciate it.  Thanks in advance for you help!</p>
  
  <p>Here is my current code:</p>
  
  <p>helloworld_final.py</p>
  
  <pre><code>def cooz():
      print ('hello worldt!')
  
  def tooz():
      print ("here is another linet")
      print ("cool!")
  
  print ("stuffz")
  tooz()
  cooz()
  
  print ()
  print ()
  
  print ("What what?")
  print ("What what?")
  </code></pre>
  
  <p>pyqt_gui_test3.py</p>
  
  <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 = 'python /users/cmbp/p4e/helloworld_final.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>