def lan_to_sos(self, items):
stmt = "import pickle\n__vars__={{ {} }}\n__vars__.update({{x:y for x,y in locals().items() if x.startswith("sos")}})\npickle.dumps(__vars__)".format(",".join(""{0}":{0}".format(x) for x in items))
response = self.sos_kernel.get_response(stmt, ["execute_result"])
try:
ret = pickle.loads(eval(response["data"]["text/plain"]))
return ret
except Exception as e:
After Change
def lan_to_sos(self, items):
stmt = "import pickle\n__vars__={{ {} }}\n__vars__.update({{x:y for x,y in locals().items() if x.startswith("sos")}})\npickle.dumps(__vars__)".format(",".join(""{0}":{0}".format(x) for x in items))
response = self.sos_kernel.get_response(stmt, ["execute_result"])[0][1]
try:
ret = pickle.loads(eval(response["data"]["text/plain"]))
return ret
except Exception as e: