title: How to run python commands using groovy in Jenkins slaves' Script Console?
body: <p>I need to run something arbitrary as simple as <code>python -c "print('hello')"</code> on one of the Jenkins' slaves' Script Console. Here's what I'm trying:</p>
  
  <pre><code>def cmd = 'python -c "print(\'hello\')"'
  def sout = new StringBuffer(), serr = new StringBuffer()
  def proc = cmd.execute()
  proc.consumeProcessOutput(sout, serr)
  proc.waitForOrKill(1000)
  println "out&gt; $sout\nerr&gt; $serr"
  </code></pre>
  
  <p>However, getting empty output:</p>
  
  <pre><code>out&gt; 
  err&gt; 
  </code></pre>
  
  <p>Is there a way to grab python's output in Groovy?</p>