From 75753f1783fa23de20a064f58b8d1116645e2c13 Mon Sep 17 00:00:00 2001 From: Greg Von Kuster Date: Wed, 9 Dec 2009 16:20:12 -0500 Subject: [PATCH] Add error handling to upload's check_zip. --- lib/galaxy/datatypes/binary.py | 2 +- tools/data_source/upload.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/galaxy/datatypes/binary.py b/lib/galaxy/datatypes/binary.py index 5daf9a79425..324a291d801 100644 --- a/lib/galaxy/datatypes/binary.py +++ b/lib/galaxy/datatypes/binary.py @@ -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: diff --git a/tools/data_source/upload.py b/tools/data_source/upload.py index 2d191d2fd4e..41c49d0dc36 100644 --- a/tools/data_source/upload.py +++ b/tools/data_source/upload.py @@ -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():