@@ -296,15 +296,16 @@ def respond(interpreter):
296
296
computer_dict = interpreter .computer .to_dict ()
297
297
if "_hashes" in computer_dict :
298
298
computer_dict .pop ("_hashes" )
299
- if computer_dict :
300
- computer_json = json .dumps (computer_dict )
301
- sync_code = f"""import json\n computer.load_dict(json.loads('''{ computer_json } '''))"""
302
- interpreter .computer .run ("python" , sync_code )
299
+ if "system_message" in computer_dict :
300
+ computer_dict .pop ("system_message" )
301
+ computer_json = json .dumps (computer_dict )
302
+ sync_code = f"""import json\n computer.load_dict(json.loads('''{ computer_json } '''))"""
303
+ interpreter .computer .run ("python" , sync_code )
303
304
except Exception as e :
304
305
if interpreter .debug :
305
306
raise
306
307
print (str (e ))
307
- print ("Continuing..." )
308
+ print ("Failed to sync iComputer with your Computer. Continuing..." )
308
309
309
310
## ↓ CODE IS RUN HERE
310
311
@@ -319,7 +320,15 @@ def respond(interpreter):
319
320
# sync up the interpreter's computer with your computer
320
321
result = interpreter .computer .run (
321
322
"python" ,
322
- "import json\n computer_dict = computer.to_dict()\n if computer_dict:\n if '_hashes' in computer_dict:\n computer_dict.pop('_hashes')\n print(json.dumps(computer_dict))" ,
323
+ """
324
+ import json
325
+ computer_dict = computer.to_dict()
326
+ if '_hashes' in computer_dict:
327
+ computer_dict.pop('_hashes')
328
+ if "system_message" in computer_dict:
329
+ computer_dict.pop("system_message")
330
+ print(json.dumps(computer_dict))
331
+ """ ,
323
332
)
324
333
result = result [- 1 ]["content" ]
325
334
interpreter .computer .load_dict (
@@ -329,7 +338,7 @@ def respond(interpreter):
329
338
if interpreter .debug :
330
339
raise
331
340
print (str (e ))
332
- print ("Continuing." )
341
+ print ("Failed to sync your Computer with iComputer. Continuing." )
333
342
334
343
# yield final "active_line" message, as if to say, no more code is running. unlightlight active lines
335
344
# (is this a good idea? is this our responsibility? i think so — we're saying what line of code is running! ...?)
0 commit comments