title: Python script doesn't fully run from Qt
body: <p>I want to run a python script from Qt. I am able to call it with <code>QProcess</code> and get <code>qDebug()</code> to print what the python script prints. But for some reason I can't Qt to read any of the python script's prints after a certain point in the code.</p>
  
  <p>Does anyone have any idea how to fix this? Thank you so much in advance. This is my first question here so I'm sorry if I did something wrong.</p>
  
  <p>My widget.cpp file and python script are below. (The python script is in the Qt program's directory.)</p>
  
  <p>My widget.cpp file:</p>
  
  <pre><code>#include "widget.h"
  #include "ui_widget.h"
  #include "QDebug"
  #include &lt;QTimer&gt;
  #include &lt;QProcess&gt;
  #include &lt;QDir&gt;
  
  
  Widget::Widget(QWidget *parent) :
      QWidget(parent),
      ui(new Ui::Widget)
  {
      ui-&gt;setupUi(this);
      QTimer *timer = new QTimer(this);
      connect(timer, SIGNAL(timeout()), this, SLOT(checkTexts()));
      timer-&gt;start(5000);
  }
  
  Widget::~Widget()
  {
      delete ui;
  }
  
  
  void Widget::checkTexts()
  {
      //QProcess process; //I also tried this way with the same results
      QProcess *process = new QProcess(this);
  
      QStringList arguments { QCoreApplication::applicationDirPath() + "/../../../../../Folder/Qt Desktop Application/ApplicationFiles/PullText.py"};
  
      process-&gt;start("python", arguments);
      process-&gt;waitForFinished(-1);
  
      QString output = process-&gt;readAll();
      process-&gt;close();
      qDebug() &lt;&lt; output;
  }
  </code></pre>
  
  <p>My Python script (PullText.py) which is supposed to send one line of a text file to my Qt application:</p>
  
  <pre><code>newMessageSplitter = "***\n"
  
  #print "1" #this prints in the qDebug() &lt;&lt; output
  
  file = open("texts.txt","r")
  
  #print “2” #this doesn't print
  
  texts = file.read()
  
  x = texts.find(newMessageSplitter) + len(newMessageSplitter)
  singleLine = texts[:x-len(newMessageSplitter)]
  file.close()
  file = open("texts.txt","w")
  file.write(texts[x:])
  file.close()
  
  #print singleLine #this is what I want to send to the output but it doesn't get sent to Qt
  </code></pre>