@@ -194,12 +194,12 @@ def tool_exec(self, tool: str, code: str, poll_interval: int = 3, debug: bool =
194194 tool_name = tool .strip ()
195195 code_string = code
196196
197- output = self ._ax_client .tools .schedule (
197+ tool_result = self ._ax_client .tools .schedule (
198198 tool_name = tool_name ,
199199 code = code_string ,
200200 )
201- if output .is_success is True :
202- job_id = str (output .job_id )
201+ if tool_result .is_success is True :
202+ job_id = str (tool_result .job_id )
203203 result = self ._ax_client .tools .status (job_id = job_id )
204204 if debug :
205205 print (f"job_id: { job_id } " )
@@ -213,7 +213,7 @@ def tool_exec(self, tool: str, code: str, poll_interval: int = 3, debug: bool =
213213 if debug :
214214 print (f"status: { result .status } " )
215215 if result .status == "SUCCEEDED" :
216- output = json .loads (result .output )
216+ output = json .loads (result .output or "{}" )
217217 if not output ['objects' ]:
218218 return result .output
219219 else :
@@ -224,12 +224,12 @@ def tool_exec(self, tool: str, code: str, poll_interval: int = 3, debug: bool =
224224 else :
225225 return result .error_trace
226226 else :
227- return output .error_trace
227+ return tool_result .error_trace
228228
229229 def load (self , job_id : str , obj_key : str ):
230230 result = self ._ax_client .tools .status (job_id = job_id )
231231 if result .status == "SUCCEEDED" :
232- output = json .loads (result .output )
232+ output = json .loads (result .output or "{}" )
233233 if not output ['objects' ]:
234234 return result .output
235235 else :
0 commit comments