News for hackers. Stuff that matters.

Python on Heroku

You can run python on heroku with a system call from a ruby app. Just run something like:

@output = `echo \"#{variable}\" | python script.py`.

This will let you read standard out from a python script.

( 5 comments | 10 points | on HN )
Re:Python on Heroku by nolite on Friday January 28, 2011 @05:30AM (#2151410)
is this documented, or something you just stumbled upon?
Re:Python on Heroku by silverlight on Friday January 28, 2011 @10:20AM (#2152105)
The fact that you can use the backticks to run commands on the server itself is well documented both from a Ruby standpoint and a Heroku standpoint (several of their examples in their documentation use this method to execute a variety of commands).

As for using Python, like another poster said it's included in most Linux distros, and Heroku is really just running a Linux distro at the end of the day. I imagine that if you wanted to run a really simple script they wouldn't care, but I wouldn't build my whole app around it, because they can turn it off at any time.

Re:Python on Heroku by SingAlong on Friday January 28, 2011 @10:14AM (#2152071)
most(all?) linux distros ship with atleast a minimal version of python. I guess that's the reason
Re:Python on Heroku by nolite on Friday January 28, 2011 @10:35AM (#2152164)
yeah ok, but if they run you in a chroot environment, you get nothing. They're also under no obligation to add python to your PATH.. a ton of reasons this could not be the case
Re:Python on Heroku by mckoss on Saturday January 29, 2011 @06:41AM (#2155255)
Perf will suck. Like running a CGI process for each request if using this for python web app.