mirror of
https://github.com/galaxyproject/galaxy.git
synced 2026-09-24 16:30:27 +08:00
Python 3: use "as" instead of comma in except clause
This commit is contained in:
@@ -88,7 +88,7 @@ def __main__():
|
||||
page = urllib.urlopen( cur_URL )
|
||||
elif URL_method == 'post':
|
||||
page = urllib.urlopen( cur_URL, urllib.urlencode( params ) )
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
stop_err( 'The remote data source application may be off line, please try again later. Error: %s' % str( e ) )
|
||||
if max_file_size:
|
||||
file_size = int( page.info().get( 'Content-Length', 0 ) )
|
||||
@@ -97,14 +97,14 @@ def __main__():
|
||||
# do sniff stream for multi_byte
|
||||
try:
|
||||
cur_filename, is_multi_byte = sniff.stream_to_open_named_file( page, os.open( cur_filename, os.O_WRONLY | os.O_CREAT ), cur_filename, source_encoding=get_charset_from_http_headers( page.headers ) )
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
stop_err( 'Unable to fetch %s:\n%s' % ( cur_URL, e ) )
|
||||
|
||||
# here import checks that upload tool performs
|
||||
if enhanced_handling:
|
||||
try:
|
||||
ext = sniff.handle_uploaded_dataset_file( filename, datatypes_registry, ext=data_dict[ 'ext' ], is_multi_byte=is_multi_byte )
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
stop_err( str( e ) )
|
||||
info = dict( type='dataset',
|
||||
dataset_id=data_dict[ 'dataset_id' ],
|
||||
|
||||
@@ -20,6 +20,6 @@ try:
|
||||
if not data:
|
||||
break
|
||||
out.write(data)
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print 'Error getting the data -> %s' % e
|
||||
out.close()
|
||||
|
||||
@@ -31,7 +31,7 @@ def exec_after_process(app, inp_data, out_data, param_dict, tool=None, stdout=No
|
||||
|
||||
try:
|
||||
page = urllib.urlopen(URL)
|
||||
except Exception, exc:
|
||||
except Exception as exc:
|
||||
raise Exception('Problems connecting to %s (%s)' % (URL, exc) )
|
||||
|
||||
name, data = out_data.items()[0]
|
||||
|
||||
@@ -96,7 +96,7 @@ def add_file( dataset, registry, json_file, output_path ):
|
||||
try:
|
||||
page = urllib.urlopen( dataset.path ) # page will be .close()ed by sniff methods
|
||||
temp_name, dataset.is_multi_byte = sniff.stream_to_file( page, prefix='url_paste', source_encoding=util.get_charset_from_http_headers( page.headers ) )
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
file_err( 'Unable to fetch %s\n%s' % ( dataset.path, str( e ) ), dataset, json_file )
|
||||
return
|
||||
dataset.path = temp_name
|
||||
@@ -111,7 +111,7 @@ def add_file( dataset, registry, json_file, output_path ):
|
||||
# Already set is_multi_byte above if type == 'url'
|
||||
try:
|
||||
dataset.is_multi_byte = multi_byte.is_multi_byte( codecs.open( dataset.path, 'r', 'utf-8' ).read( 100 ) )
|
||||
except UnicodeDecodeError, e:
|
||||
except UnicodeDecodeError as e:
|
||||
dataset.is_multi_byte = False
|
||||
# Is dataset an image?
|
||||
image = check_image( dataset.path )
|
||||
@@ -364,7 +364,7 @@ def add_composite_file( dataset, json_file, output_path, files_path ):
|
||||
if isurl:
|
||||
try:
|
||||
temp_name, dataset.is_multi_byte = sniff.stream_to_file( urllib.urlopen( dp ), prefix='url_paste' )
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
file_err( 'Unable to fetch %s\n%s' % ( dp, str( e ) ), dataset, json_file )
|
||||
return
|
||||
dataset.path = temp_name
|
||||
|
||||
Reference in New Issue
Block a user