nbaldwin commited on
Commit
ba75a99
·
1 Parent(s): 310b87e

bug fix for code runs

Browse files
InterpreterAtomicFlow.py CHANGED
@@ -111,6 +111,7 @@ class InterpreterAtomicFlow(AtomicFlow):
111
  for line in code_interpreter.run(code):
112
  if "output" in line:
113
  output += "\n" + line["output"]
 
114
  # Truncate output
115
  output = truncate_output(output, self.max_output)
116
  output = output.strip()
 
111
  for line in code_interpreter.run(code):
112
  if "output" in line:
113
  output += "\n" + line["output"]
114
+ code_runs = line.get("code_runs", True)
115
  # Truncate output
116
  output = truncate_output(output, self.max_output)
117
  output = output.strip()
code_interpreters/subprocess_code_interpreter.py CHANGED
@@ -64,7 +64,7 @@ class SubprocessCodeInterpreter(BaseCodeInterpreter):
64
  if not self.process:
65
  self.start_process()
66
  except:
67
- yield {"output": traceback.format_exc()}
68
  return
69
 
70
 
@@ -83,7 +83,7 @@ class SubprocessCodeInterpreter(BaseCodeInterpreter):
83
  # For UX, I like to hide this if it happens once. Obviously feels better to not see errors
84
  # Most of the time it doesn't matter, but we should figure out why it happens frequently with:
85
  # applescript
86
- yield {"output": traceback.format_exc()}
87
  yield {"output": f"Retrying... ({retry_count}/{max_retries})"}
88
  yield {"output": "Restarting process."}
89
 
@@ -91,7 +91,7 @@ class SubprocessCodeInterpreter(BaseCodeInterpreter):
91
 
92
  retry_count += 1
93
  if retry_count > max_retries:
94
- yield {"output": "Maximum retries reached. Could not execute code."}
95
  return
96
 
97
  while True:
 
64
  if not self.process:
65
  self.start_process()
66
  except:
67
+ yield {"output": traceback.format_exc(), "code_runs": False}
68
  return
69
 
70
 
 
83
  # For UX, I like to hide this if it happens once. Obviously feels better to not see errors
84
  # Most of the time it doesn't matter, but we should figure out why it happens frequently with:
85
  # applescript
86
+ yield {"output": traceback.format_exc(), "code_runs": False}
87
  yield {"output": f"Retrying... ({retry_count}/{max_retries})"}
88
  yield {"output": "Restarting process."}
89
 
 
91
 
92
  retry_count += 1
93
  if retry_count > max_retries:
94
+ yield {"output": "Maximum retries reached. Could not execute code.", "code_runs": False}
95
  return
96
 
97
  while True: