Add error handling to upload's check_zip.

This commit is contained in:
Greg Von Kuster
2009-12-09 16:20:12 -05:00
parent c141dbd7ba
commit 75753f1783
2 changed files with 5 additions and 2 deletions
+1 -1
View File
@@ -99,7 +99,7 @@ class Bam( Binary ):
stderr_name = tempfile.NamedTemporaryFile( prefix = "bam_index_stderr" ).name
command = 'samtools index %s %s' % ( dataset.file_name, index_file.file_name )
proc = subprocess.Popen( args=command, shell=True, stderr=open( stderr_name, 'wb' ) )
proc.wait()
#Did index succeed?
stderr = open( stderr_name ).read().strip()
if stderr:
+4 -1
View File
@@ -118,7 +118,10 @@ def check_zip( temp_name ):
# 1. Archives can only include .ab1, .scf or .txt files
# 2. All file extensions within an archive must be the same
name = zip_file.namelist()[0]
test_ext = name.split( "." )[1].strip().lower()
try:
test_ext = name.split( "." )[1].strip().lower()
except:
return ( True, False, None )
if not ( test_ext in unsniffable_binary_formats or test_ext == 'txt' ):
return ( True, False, test_ext )
for name in zip_file.namelist():