# HG changeset patch # User geert-vandeweyer # Date 1395767725 14400 # Node ID fe42761670f1393effa6a9c3a5caace3a96f5fcd # Parent 837fafa672d248fe7a0efc7da2c8ef45a59e47f9 Uploaded diff -r 837fafa672d2 -r fe42761670f1 DownloadFiles.py --- a/DownloadFiles.py Tue May 07 09:02:02 2013 -0400 +++ b/DownloadFiles.py Tue Mar 25 13:15:25 2014 -0400 @@ -39,9 +39,16 @@ storedir="%s/%s/%s/" %(ftpdirconfig,useremail,folder) subdir = folder if not os.path.exists(ftpdir): - os.makedirs(ftpdir) + try: + os.makedirs(ftpdir) + except: + stop_err("User dir on FTP could not be created: %s" % (ftpdir)) if not os.path.exists(storedir): - os.makedirs(storedir) + + try: + os.makedirs(storedir) + except: + stop_err("Target dir could not be created: %s" % (storedir)) while filecounter < len(sys.argv): inp = sys.argv[filecounter] @@ -51,10 +58,16 @@ name = name.replace('@','_AT_') ext = sys.argv[(filecounter+2)] # copy files to tmp dir & filenames - os.system("cp '%s' '%s/%s.%s'" %(inp, storedir,name,ext)) + try: + os.system("cp '%s' '%s/%s.%s'" %(inp, storedir,name,ext)) + except: + stop_err("Copy failed for target file : %s/%s.%s. Command was\ncp '%s' '%s/%s.%s'" % (storedir,name,ext,inp,storedir,name,ext)) ## gzip if fastq/fastqsanger/vcf if ( ext == "fastq" or ext == "fastqsanger" or ext == "vcf" or ext == "sam" or ext == "txt"): - os.system("gzip -9 '%s/%s.%s'" %(storedir,name,ext)) + try: + os.system("gzip -9 '%s/%s.%s'" %(storedir,name,ext)) + except: + stop_err("Compression of %s/%s.%s failed." % (storedir,name,ext)) fout.write("