Skip to content

Instantly share code, notes, and snippets.

@itsderek23
Created September 18, 2012 17:00
Show Gist options
  • Select an option

  • Save itsderek23/3744312 to your computer and use it in GitHub Desktop.

Select an option

Save itsderek23/3744312 to your computer and use it in GitHub Desktop.
Scout running Python Code
$scout test py.rb
== This plugin doesn't have option metadata.
== You haven't provided any options for running this plugin.
== Output:
{:server_name=>nil,
:errors=>[],
:reports=>
[{:created_at=>"2012-09-18 17:00:05",
:fields=>{:random=>7.0},
}
class Py < Scout::Plugin
def build_report
code=<<END_OF_CODE
from random import randint
print randint(2,9)
END_OF_CODE
analysis = open("| python 2>&1", "r+") do |py|
py.puts(code)
py.close_write
py.read
end
report :random => analysis.to_f
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment