I've got a program that has a small file structure going on and is then ran using
python do_work.py foo bar
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 do_work.py
(say, it's result.txt
)
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)
What is the best way to go about it? Can rake run exec Python? More importantly, is this doable on heroku?
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 ls
seem to work.
Could it be a permissions problem?
def index
value = %x( python --version )
render :text => value
end
Incidentally, trying this in irb
:
%x(python)
Brings up the Python terminal INSIDE of irb. It will not take params for whatever reason however.