Changeset 2fb99de in flex_extract.git for python/tools.py
- Timestamp:
- Sep 20, 2018, 11:56:37 AM (6 years ago)
- Branches:
- master, ctbto, dev
- Children:
- 5d42acd
- Parents:
- 3232589
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/tools.py
refa05d7 r2fb99de 124 124 parser.add_argument("--debug", dest="debug", default=None, 125 125 help="debug mode - leave temporary files intact") 126 parser.add_argument("--request", dest="request", default=None, 127 help="list all mars request in file mars_requests.dat \ 128 and skip submission to mars") 126 129 127 130 args = parser.parse_args() … … 137 140 @Input: 138 141 filename: string 139 Name offile where the ECMWV environment parameters are stored.142 Path to file where the ECMWV environment parameters are stored. 140 143 141 144 @Return: 142 145 envs: dict 146 Contains the environment parameter ecuid, ecgid, gateway 147 and destination for ECMWF server environments. 143 148 ''' 144 149 envs= {} 145 print filename 150 146 151 with open(filename, 'r') as f: 147 152 for line in f: … … 175 180 ''' 176 181 177 print "clean_up"182 print("clean_up") 178 183 179 184 cleanlist = glob.glob(c.inputdir + "/*") … … 184 189 silent_remove(clist) 185 190 186 print "Done"191 print("Done") 187 192 188 193 return … … 208 213 ''' 209 214 210 print message215 print(message) 211 216 212 217 # comment if user does not want email notification directly from python … … 224 229 pout = p.communicate(input=message + '\n\n' + trace)[0] 225 230 except ValueError as e: 226 print 'ERROR: ', e231 print('ERROR: ', e) 227 232 sys.exit('Email could not be sent!') 228 233 else: 229 print 'Email sent to ' + os.path.expandvars(user) + ' ' + \230 pout.decode() 234 print('Email sent to ' + os.path.expandvars(user) + ' ' + 235 pout.decode()) 231 236 232 237 sys.exit(1) … … 253 258 254 259 ''' 255 print message260 print(message) 256 261 257 262 # comment if user does not want notification directly from python … … 268 273 pout = p.communicate(input=message+'\n\n')[0] 269 274 except ValueError as e: 270 print 'ERROR: ', e271 print 'Email could not be sent!'275 print('ERROR: ', e) 276 print('Email could not be sent!') 272 277 else: 273 print 'Email sent to ' + os.path.expandvars(user) + ' ' + \274 pout.decode() 278 print('Email sent to ' + os.path.expandvars(user) + ' ' + 279 pout.decode()) 275 280 276 281 return … … 392 397 break 393 398 else: 394 print 'Warning: par ' + par + ' not found in table 128'399 print('Warning: par ' + par + ' not found in table 128') 395 400 396 401 return ipar … … 438 443 raise # re-raise exception if a different error occured 439 444 else: 440 print 'WARNING: Directory {0} already exists!'.format(directory)445 print('WARNING: Directory {0} already exists!'.format(directory)) 441 446 442 447 return … … 482 487 stderr=subprocess.STDOUT) 483 488 except subprocess.CalledProcessError as e: 484 print '... ERROR CODE:\n ... ', e.returncode 485 print '... ERROR MESSAGE:\n ... ', e 486 print '... COMMAND MESSAGE:\n ...', e.output 487 488 print '\nDo you have a valid eccert key?' 489 print('... ERROR CODE:\n ... ' + str(e.returncode)) 490 print('... ERROR MESSAGE:\n ... ' + str(e)) 491 492 print('\n... Do you have a valid ecaccess certification key?') 489 493 sys.exit('... ECACCESS-FILE-PUT FAILED!') 490 494 … … 520 524 jobname]) 521 525 except subprocess.CalledProcessError as e: 522 print '... ERROR CODE: ', e.returncode523 print '... ERROR MESSAGE:\n ... ', e524 print '... COMMAND MESSAGE:\n ...', e.output 525 526 print '\nDo you have a valid eccert key?'526 print('... ERROR CODE:\n ... ' + str(e.returncode)) 527 print('... ERROR MESSAGE:\n ... ' + str(e)) 528 529 530 print('\n... Do you have a valid ecaccess certification key?') 527 531 sys.exit('... ECACCESS-JOB-SUBMIT FAILED!') 528 532
Note: See TracChangeset
for help on using the changeset viewer.