-
-
Save skipallmighty/8c08423efeaa7b8b6a51 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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