Python 3: use "as" instead of comma in except clause

This commit is contained in:
Nicola Soranzo
2016-05-17 23:53:16 +01:00
parent ed4132d9c0
commit 8a43b2b492
73 changed files with 152 additions and 152 deletions
+3 -3
View File
@@ -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' ],