提交 dde86185 编写于 作者: 若苗瞬's avatar 若苗瞬 😶

mod: read WORKSPACE path for env param, in case it is moved.

mod: check before delete.
上级 149a2017
...@@ -7,6 +7,10 @@ import sys ...@@ -7,6 +7,10 @@ import sys
print() print()
modelPath="..\\..\\workspace\\model\\" modelPath="..\\..\\workspace\\model\\"
wsPath = os.environ.get("WORKSPACE")
if wsPath != "":
modelPath=wsPath+"\\model\\"
DFLModelOptionF = "" DFLModelOptionF = ""
if len(sys.argv) < 2: if len(sys.argv) < 2:
# print("Error! need a model file name!") # print("Error! need a model file name!")
...@@ -115,29 +119,33 @@ while True: ...@@ -115,29 +119,33 @@ while True:
content = input("Please input param value: ") content = input("Please input param value: ")
print() print()
if content == ' ': if content == ' ':
del MOption['options'][key] if key in MOption['options']:
isModified = True del MOption['options'][key]
print("["+key+"] is deleted.")
isModified = True
else:
print("["+key+"] is not found to delete!")
else: else:
try: try:
intcontent = int(content) intcontent = int(content)
MOption['options'][key] = intcontent MOption['options'][key] = intcontent
print(key+" is set to INTEGER value =",intcontent) print("["+key+"] is set to INTEGER value =",intcontent)
except: except:
try: try:
fcontent = float(content) fcontent = float(content)
MOption['options'][key] = fcontent MOption['options'][key] = fcontent
print(key+" is set to FLOAT value =",fcontent) print("["+key+"] is set to FLOAT value =",fcontent)
except: except:
try: try:
bcontent = bool(strtobool(content)) bcontent = bool(strtobool(content))
MOption['options'][key] = bcontent MOption['options'][key] = bcontent
print(key+" is set to BOOL value =",bcontent) print("["+key+"] is set to BOOL value =",bcontent)
except: except:
MOption['options'][key] = content MOption['options'][key] = content
print(key+" is set to STRING value =",content) print("["+key+"] is set to STRING value =",content)
print("Press any key to choose param...")
input()
isModified = True isModified = True
print("Press any key to choose next param...")
input()
else: else:
print("No option found in file...") print("No option found in file...")
print() print()
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册