Skip to content

Instantly share code, notes, and snippets.

@skipallmighty
Created August 30, 2014 16:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save skipallmighty/8c08423efeaa7b8b6a51 to your computer and use it in GitHub Desktop.
Save skipallmighty/8c08423efeaa7b8b6a51 to your computer and use it in GitHub Desktop.
@blueprint.route("/repl/run/", methods=["POST"])
def repl_run():
import subprocess
if 'code' in request.form:
run_this = request.form['code']
run_this = run_this.replace('\n',';').replace('/\r/',';')
try:
output = subprocess.check_output(['python', '-c', 'print 1 + r'])
except subprocess.CalledProcessError as e:
return e.message
else:
return output
return output
Does not return that error to the output... does print it to the command line.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment