Changeset 2421 for TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py
- Timestamp:
- 03/02/15 14:19:08 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py
r2417 r2421 25 25 try : 26 26 res = subprocess.check_output(command) 27 except Exception as rc 28 #print(rc)27 except Exception as rc: 28 print(rc) 29 29 res = None 30 30 … … 37 37 command = ["du", "-sbh", dirname] 38 38 try : 39 res = float(subprocess.check_output(command)) 39 res = subprocess.check_output(command) 40 res = res.split()[0] 41 40 42 except Exception as rc : 41 43 print(rc) … … 65 67 print(rc) 66 68 exit() 67 with open(os.path.join(DIR["DATA"], OUT _CCCMP), "w") as fileout:69 with open(os.path.join(DIR["DATA"], OUT["CCCMP"]), "w") as fileout: 68 70 fileout.write(res) 69 71 … … 259 261 igcm_out = os.path.join(storedir, "IGCM_OUT") 260 262 261 for dirname in os.listdir(igcm_out): 262 print(dirname, get_dirsize(dirname)) 263 263 if not os.path.isdir(igcm_out): 264 break 265 266 dirlist = [] 267 try: 268 dirlist = os.listdir(igcm_out) 269 except OSError as rc: 270 print("Error on os.listdir({}):\n{}".format(igcm_out, rc)) 271 272 for dirname in dirlist: 264 273 result_str = "{:%Y-%m-%d} {:10s} {:>7s} {:s}\n".format( 265 274 today, 266 275 login, 267 get_dirsize( dirname),268 dirname276 get_dirsize(os.path.join(igcm_out, dirname)), 277 os.path.join(igcm_out, dirname) 269 278 ) 270 if args.dryrun: 279 280 if args.dryrun or args.verbose: 271 281 print(result_str.strip()) 272 else: 282 283 if not args.dryrun: 273 284 fileout.write(result_str) 274 285
Note: See TracChangeset
for help on using the changeset viewer.