代码在第一次运行时按预期运行,但如果我再次运行它,它会使自动化服务台崩溃。如果我在Python中运行它,就没有错误,我可以重复运行它。在
“AD”是AutomationDesk变量,在AutomationDesk之外不工作。对于测试,我将该部分注释掉,只使用DEBUG而不是AD.DEBUG。在
Automation desk是dSpace的一个软件。在from Tkinter import *
import Tkinter,tkFileDialog,tkMessageBox
from datetime import datetime
#print time
now = datetime.now()
print "Test Start time is: "+'%s:%s:%s' % (now.hour, now.minute,now.second)
#hide the main window
root = Tk()
root.withdraw()
#Debugger option
debugYN = tkMessageBox.askyesno("Debug", "Would you like to debug?")
if debugYN == True:
_AD_.DEBUG = 1
print "Debugging enabled"
else:
_AD_.DEBUG = 0
#File name selection
file = tkFileDialog.askopenfilename()
if file != None and debugYN == True:
print file
_AD_.DFCxlsPath = file
if _AD_.DEBUG == 1:
now = datetime.now()
print "Select XLS & Debug Completed at "+'%s:%s:%s' % (now.hour, now.minute,now.second)
root = None
#root.destroy()
del file
del debugYN
#remove now here because no matter what we print the start time
del now