title: Store output results of Hive query via beeline in a string. tried running with Popen as well but did not work
body: <p>I am running a hive query from Python script. I was able to run it with out any issue when i used subprocess.getstatusoutput, but unable to store the result into a variable. So i tried to do with Popen, i get an error saying unable to </p>
  
  <pre><code>dd1 = '10-Sep-12'
  table = 'testing_table'
  1&gt; query = "select distinct(input__file__name) from &lt;db_name&gt;." + table + " where as_of_date =" +"'"+ dd1 +"'"+ " limit 2"
  
  2&gt; cmd = 'beeline -u "jdbc:hive2:&lt;connection string&gt;" -e "'+query + ';"'
  
  3&gt; stat, query_output = subprocess.getstatusoutput(cmd)
  </code></pre>
  
  <p>This is working but when I try to print query_output, it prints all the output (like 'info' tags about all the stages and the exact o/p of query)</p>
  
  <p>instead of getstatusoutput, when i use subprocess.Popen or subprocess.check_output I am getting an error as below: </p>
  
  <pre><code>FileNotFoundError: [Errno 2] No such file or directory: 'beeline -u "&lt;connection string&gt;" -e "select distinct(input__file__name) from &lt;db_name&gt;.&lt;table_name&gt; where as_of_date =\'10-Sep-12\' limit 2;"'
  </code></pre>