diff --git a/script/EnergyScan.py b/script/EnergyScan.py index b01a325..01caa64 100644 --- a/script/EnergyScan.py +++ b/script/EnergyScan.py @@ -33,6 +33,8 @@ start = time.localtime() folder = os.path.expanduser("~/Data1/") + FOLDER + "/"; def getNewestFile(): + global folder + import glob try: return max(glob.iglob(folder+'/*.txt'), key=os.path.getctime) except: @@ -79,15 +81,20 @@ print "Finished Energy scan" #File convertion -#newName = folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt"; -name = caget("MSG").split(' ')[0] +newName = folder + time.strftime("%Y%m%d_%H%M_", start) + FILE + "_0000.txt"; +#name = caget("MSG").split(' ')[0] name = getNewestFile() +print "Newest was" + str(newest) +print "Now is" + str(name) +print "MSG = " + caget("MSG") + if name == newest: raise Exception("Data file not created") if not os.path.isfile(name): raise Exception("Data file not found: " + name) + cmd = "/sls/X07MA/data/x07maop/bin/modify_otf.pl " + name + " " + newName; print("Converting data file: " + cmd); import os