sampcd+='\nprint('+'\"'+name+' sample code is executed successfully!\")'
iflen(sampcd_begins)>1:
tfname=name+"_example_"+str(y)+".py"
else:
tfname=name+"_example"+".py"
tempf=open("samplecode_temp/"+tfname,'w')
tempf.write(sampcd)
tempf.close()
ifplatform.python_version()[0]=="2":
cmd=["python","samplecode_temp/"+tfname]
elifplatform.python_version()[0]=="3":
cmd=["python3","samplecode_temp/"+tfname]
else:
else:
print("Error: fail to parse python version!")
print("Error: Found %s result but %s python file."%
result=False
(len(sampre_begins),len(sampcd_begins)))
exit(1)
print(
"If you think the sample code of this api is not suitable for the return result, please add the white list in FIle: tools/wlist_return.json first. And you must have one TPM(saxon-zh or swtkiwi or Boyan-Liu) approve for the white list."
"Error: Your sample code have returned a result, but execute sample code don't get result!"
)
print(
"If you think the sample code of this api is not suitable for the return result, please add the white list in FIle: tools/wlist_return.json first. And you must have one TPM(saxon-zh or swtkiwi or Boyan-Liu) approve for the white list."
"Error: Mistake found in the return result of sample code."
)
print("There maybe three reasons for this error:")
print(
"1. The input of the sample code is a random number.Please add the white list in FIle: tools/return_white_list.txt first .And you must have one TPM(saxon-zh or swtkiwi or Boyan-Liu) approve for the white list."
)
print(
"2. The return value of the sample code is incorrect. Please check the code and reset the return value."
)
print(
"3. If you think the sample code of this api is not suitable for the return result, please add the white list in FIle: tools/wlist_return.json first. And you must have one TPM(saxon-zh or swtkiwi or Boyan-Liu) approve for the white list."
)
result=False
else:
ifnamenotinwlist_return:
print_header(htype,hname)
print(
"Error: If you think the sample code of this api is not suitable for the return result, please add the white list in FIle: tools/wlist_return.json first. And you must have one TPM(saxon-zh or swtkiwi or Boyan-Liu) approve for the white list."