/usr/share/pyshared/planet/shell/py.py is in planet-venus 0~bzr116-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | from subprocess import Popen, PIPE
import sys
def run(script, doc, output_file=None, options={}):
""" process an Python script """
if output_file:
out = open(output_file, 'w')
else:
out = PIPE
options = sum([['--'+key, value] for key,value in options.items()], [])
proc = Popen([sys.executable, script] + options,
stdin=PIPE, stdout=out, stderr=PIPE)
stdout, stderr = proc.communicate(doc)
if stderr:
import planet
planet.logger.error(stderr)
return stdout
|