title: Qt Calling External Python Script
body: <p>I am trying to write a GUI wrapper for one of my command line tools written in Python.<br>
  It was suggested to me that I should use Qt. </p>
  
  <p>Below is my project's .cpp file:</p>
  
  <pre><code>#include "v_1.h"
  #include "ui_v_1.h"
  #include&lt;QtCore/QFile&gt;
  #include&lt;QtCore/QTextStream&gt;
  #include &lt;QProcess&gt;
  #include &lt;QPushButton&gt;
  v_1::v_1(QWidget *parent) :
      QMainWindow(parent),ui(new Ui::v_1)
      {
          ui-&gt;setupUi(this);
      }
      v_1::~v_1()
      {
          delete ui;
      }
  
  void v_1::on_pushButton_clicked()
  {
      QProcess p;
      p.start("python script -arg1 arg1");
      p.waitForFinished(-1);
      QString p_stdout = p.readAllStandardOutput();
      ui-&gt;lineEdit-&gt;setText(p_stdout);
  }
  </code></pre>
  
  <p>Below is my project's header file:</p>
  
  <pre><code>#ifndef V_1_H
  #define V_1_H
  #include &lt;QMainWindow&gt;
  namespace Ui {
  class v_1;
  }
  
  class v_1 : public QMainWindow
  {
      Q_OBJECT   
  public:
      explicit v_1(QWidget *parent = 0);
      ~v_1();
  
  private slots:
      void on_pushButton_clicked();
  private:
      Ui::v_1 *ui;
  };
  
  #endif // V_1_H
  </code></pre>
  
  <p>The UI file is just a Push Button and a LineEdit widget.</p>
  
  <p>I allocated the Push Button a slot when it is clicked. The <code>on_pushButton_clicked()</code> method works fine when I call some utilities like <code>ls</code> or <code>ps</code>, and it pipes the output of those commands to the LineEdit widget, but when I try calling a Python script, it does not show me anything on the LineEdit widget.</p>
  
  <p>Any help would be greatly appreciated.</p>