diff --git a/macros/runCond/getTempFromPlus.py b/macros/runCond/getTempFromPlus.py index 8542da1..7913471 100644 --- a/macros/runCond/getTempFromPlus.py +++ b/macros/runCond/getTempFromPlus.py @@ -15,14 +15,21 @@ location_tt = '/group/st/sw/RadiationMonitoring/LeakageCurrent/InputData/TT/Temperatures' location_it = '/group/st/sw/RadiationMonitoring/LeakageCurrent/InputData/IT/Temperatures' for y in years: - os.system('scp egraveri@lbgw:%s/tt_box_temperatures_%s.txt .' % (location_tt, y)) - os.system('scp egraveri@lbgw:%s/it_box_temperatures_%s.txt .' % (location_it, y)) + try: + os.system('scp egraveri@lbgw:%s/tt_box_temperatures_%s.txt .' % (location_tt, y)) + os.system('scp egraveri@lbgw:%s/it_box_temperatures_%s.txt .' % (location_it, y)) + except: + print('Could not find temperature files for year %s' % y) output_location = '/afs/cern.ch/user/e/egraveri/cmtuser/STMonitoring/STAging/data/temperature' output_tt = output_location + '/tttemp.txt' output_it = output_location + '/ittemp.txt' print('Backing up old files...') -os.system('mv %s %s_BK' % (output_tt, output_tt)) -os.system('mv %s %s_BK' % (output_it, output_it)) +try: + os.system('mv %s %s_BK' % (output_tt, output_tt)) + os.system('mv %s %s_BK' % (output_it, output_it)) +except: + print('Could not backup old files %s and/or %s (files not found or unable to write)' % (output_tt, output_it)) + raw_input('Continue anyway? Press CTRL-C to exit.') def concatenate(filelist, destination): @@ -37,6 +44,12 @@ concatenate(files_tt, output_tt) concatenate(files_it, output_it) for f in files_tt: - os.system('rm %s' % f) + try: + os.system('rm %s' % f) + except: + print('Could not find %s' % f) for f in files_it: - os.system('rm %s' % f) + try: + os.system('rm %s' % f) + except: + print('Could not find %s' % f)