""" 2018-10-13 author: christoph Seitz """ command_path_tmp = "/sls/X03DA/data/gac-x03da/Data1/2018/10/Granas/XPSstuff/commands/set_measure.txt" print __name__ while: time.sleep(4) if os.path.exists(command_path_tmp): cont = open(command_path_tmp).read() #reading command from file if "manipulator spectrum O1s" in cont: select_edge_tmp = "O1s " execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/ManipulatorScan.py") elif "fermi edge O1s" in cont: select_edge_tmp = "O1s " execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/XPSSpectrum.py") # check values carefully elif "fermi edge C1s" in cont: select_edge_tmp = "C1s " execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/XPSSpectrum.py") elif "manipulator spectrum C1s" in cont: select_edge_tmp = "C1s " execfile("/sls/X03DA/data/gac-x03da/pshell/home/script/users/Granas/ManipulatorScan.py") if "exit_loop": break #printing the end to file for i in range(3): try: print("loop is closed now") open(path,'w').write("loop is closed now") break except: print("ending loop failed") print("trying again")