title: How to integrate a standalone Python script into a Rails application?
body: <p>I've got a program that has a small file structure going on and is then ran using</p>
  
  <pre><code>python do_work.py foo bar
  </code></pre>
  
  <p>I want my Rails users to press a button and have this happen for them, with the result either uploaded somewhere or just thrown to them as a download link or something of the sort - the output of <code>do_work.py</code> (say, it's <code>result.txt</code>)</p>
  
  <p>I also want to clarify that the script results in the creation on the filesystem of 3 separate files, which are not text files (which shouldn't matter and isn't really the problem here)</p>
  
  <p>What is the best way to go about it? Can rake run exec Python? More importantly, is this doable on heroku?</p>
  
  <p>I have Python installed on my system but the provided answer by sockmonk doesn't seem to work - it returns nil. Mind you, other commands like <code>ls</code> seem to work.</p>
  
  <p>Could it be a permissions problem?</p>
  
  <pre><code>def index
      value = %x( python --version )
      render :text =&gt; value
  end
  </code></pre>
  
  <p>Incidentally, trying this in <code>irb</code>:</p>
  
  <pre><code>%x(python)
  </code></pre>
  
  <p>Brings up the Python terminal INSIDE of irb. It will not take params for whatever reason however.</p>