Ignore:
Timestamp:
03/02/15 14:19:08 (9 years ago)
Author:
labetoulle
Message:

copy plots on dods

File:
1 edited

Legend:

Unmodified
Added
Removed
  • TOOLS/ConsoGENCMIP6/bin/conso_gencmip6.py

    r2417 r2421  
    2525  try : 
    2626    res = subprocess.check_output(command) 
    27   except Exception as rc : 
    28     # print(rc) 
     27  except Exception as rc: 
     28    print(rc) 
    2929    res = None 
    3030 
     
    3737  command = ["du", "-sbh", dirname] 
    3838  try : 
    39     res = float(subprocess.check_output(command)) 
     39    res = subprocess.check_output(command) 
     40    res = res.split()[0] 
     41 
    4042  except Exception as rc : 
    4143    print(rc) 
     
    6567      print(rc) 
    6668      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: 
    6870      fileout.write(res) 
    6971 
     
    259261      igcm_out = os.path.join(storedir, "IGCM_OUT") 
    260262 
    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: 
    264273        result_str = "{:%Y-%m-%d} {:10s} {:>7s} {:s}\n".format( 
    265274                       today, 
    266275                       login, 
    267                        get_dirsize(dirname), 
    268                        dirname 
     276                       get_dirsize(os.path.join(igcm_out, dirname)), 
     277                       os.path.join(igcm_out, dirname) 
    269278                     ) 
    270         if args.dryrun: 
     279 
     280        if args.dryrun or args.verbose: 
    271281          print(result_str.strip()) 
    272         else: 
     282 
     283        if not args.dryrun: 
    273284          fileout.write(result_str) 
    274285 
Note: See TracChangeset for help on using the changeset viewer.