Artificial-superintelligence commited on
Commit
6407b2f
·
verified ·
1 Parent(s): 92018fe

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -1,8 +1,10 @@
 
1
  from flask import Flask, request, jsonify, render_template, stream_with_context, Response
2
  import os
3
  import subprocess
4
  import tempfile
5
  import shutil
 
6
 
7
  app = Flask(__name__)
8
 
@@ -42,8 +44,9 @@ def execute_code():
42
  shell_command = command[1:]
43
  return Response(stream_with_context(execute_shell_command(shell_command)))
44
  else:
 
45
  process = subprocess.run(
46
- ["python3", "-c", command],
47
  stdout=subprocess.PIPE,
48
  stderr=subprocess.PIPE,
49
  text=True,
@@ -62,4 +65,4 @@ def cleanup():
62
  return jsonify({"result": "Temporary files cleaned up."})
63
 
64
  if __name__ == "__main__":
65
- app.run(host="0.0.0.0", port=7860)
 
1
+
2
  from flask import Flask, request, jsonify, render_template, stream_with_context, Response
3
  import os
4
  import subprocess
5
  import tempfile
6
  import shutil
7
+ import sys
8
 
9
  app = Flask(__name__)
10
 
 
44
  shell_command = command[1:]
45
  return Response(stream_with_context(execute_shell_command(shell_command)))
46
  else:
47
+ # Use sys.executable to ensure we're using the correct Python interpreter
48
  process = subprocess.run(
49
+ [sys.executable, "-c", command],
50
  stdout=subprocess.PIPE,
51
  stderr=subprocess.PIPE,
52
  text=True,
 
65
  return jsonify({"result": "Temporary files cleaned up."})
66
 
67
  if __name__ == "__main__":
68
+ app.run(host="0.0.0.0", port=7860, debug=True)