Skip to content

Commit bdc4457

Browse files
committed
Old exception handling format to new one
1 parent ba356ba commit bdc4457

File tree

11 files changed

+26
-27
lines changed

11 files changed

+26
-27
lines changed

extra/cloak/cloak.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ def main():
6161
if not args.inputFile:
6262
parser.error('Missing the input file, -h for help')
6363

64-
except (OptionError, TypeError), e:
65-
parser.error(e)
64+
except (OptionError, TypeError) as ex:
65+
parser.error(ex)
6666

6767
if not os.path.isfile(args.inputFile):
6868
print('ERROR: the provided input file \'%s\' is non existent' % args.inputFile)

extra/dbgtool/dbgtool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def main(inputFile, outputFile):
8888
if not args.inputFile:
8989
parser.error("Missing the input file, -h for help")
9090

91-
except (OptionError, TypeError), e:
92-
parser.error(e)
91+
except (OptionError, TypeError) as ex:
92+
parser.error(ex)
9393

9494
inputFile = args.inputFile
9595
outputFile = args.outputFile

extra/safe2bin/safe2bin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ def main():
110110
if not args.inputFile:
111111
parser.error('Missing the input file, -h for help')
112112

113-
except (OptionError, TypeError), e:
114-
parser.error(e)
113+
except (OptionError, TypeError) as ex:
114+
parser.error(ex)
115115

116116
if not os.path.isfile(args.inputFile):
117117
print('ERROR: the provided input file \'%s\' is not a regular file' % args.inputFile)

lib/core/profiling.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
import cProfile
1111

1212
from lib.core.common import getSafeExString
13-
from lib.core.common import getUnicode
1413
from lib.core.data import logger
1514
from lib.core.data import paths
1615
from lib.core.settings import UNICODE_ENCODING

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.3.1.71"
22+
VERSION = "1.3.1.72"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)

thirdparty/beautifulsoup/beautifulsoup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1836,7 +1836,7 @@ def _convertFrom(self, proposed):
18361836
u = self._toUnicode(markup, proposed)
18371837
self.markup = u
18381838
self.originalEncoding = proposed
1839-
except Exception, e:
1839+
except Exception as e:
18401840
# print "That didn't work!"
18411841
# print e
18421842
return None

thirdparty/clientform/clientform.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ def _ParseFileEx(file, base_uri,
11001100
data = file.read(CHUNK)
11011101
try:
11021102
fp.feed(data)
1103-
except ParseError, e:
1103+
except ParseError as e:
11041104
e.base_uri = base_uri
11051105
raise
11061106
if len(data) != CHUNK: break
@@ -2902,7 +2902,7 @@ def __setitem__(self, name, value):
29022902
control = self.find_control(name)
29032903
try:
29042904
control.value = value
2905-
except AttributeError, e:
2905+
except AttributeError as e:
29062906
raise ValueError(str(e))
29072907

29082908
def get_value(self,

thirdparty/colorama/ansitowin32.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ def write_plain_text(self, text, start, end):
180180
def _write(self, text, retry=5):
181181
try:
182182
self.wrapped.write(text)
183-
except IOError, err:
183+
except IOError as err:
184184
if not (err.errno == 0 and retry > 0):
185185
raise
186186
self._write(text, retry-1)

thirdparty/gprof2dot/gprof2dot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -695,7 +695,7 @@ def next(self):
695695
self.final = len(data) < size
696696
try:
697697
self.parser.Parse(data, self.final)
698-
except xml.parsers.expat.ExpatError, e:
698+
except xml.parsers.expat.ExpatError as e:
699699
#if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS:
700700
if e.code == 3:
701701
pass

thirdparty/keepalive/keepalive.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ def do_open(self, req):
238238
self._cm.add(host, h, 0)
239239
self._start_transaction(h, req)
240240
r = h.getresponse()
241-
except (socket.error, httplib.HTTPException), err:
241+
except (socket.error, httplib.HTTPException) as err:
242242
raise urllib2.URLError(err)
243243

244244
if DEBUG: DEBUG.info("STATUS: %s, %s", r.status, r.reason)
@@ -323,7 +323,7 @@ def _start_transaction(self, h, req):
323323
h.putrequest(req.get_method() or 'GET', req.selector, skip_host=req.has_header("Host"), skip_accept_encoding=req.has_header("Accept-encoding"))
324324
else:
325325
h.putrequest(req.get_method() or 'GET', req.get_selector(), skip_host=req.has_header("Host"), skip_accept_encoding=req.has_header("Accept-encoding"))
326-
except (socket.error, httplib.HTTPException), err:
326+
except (socket.error, httplib.HTTPException) as err:
327327
raise urllib2.URLError(err)
328328

329329
if not req.headers.has_key('Connection'):
@@ -495,7 +495,7 @@ def error_handler(url):
495495
fo.close()
496496
try: status, reason = fo.status, fo.reason
497497
except AttributeError: status, reason = None, None
498-
except IOError, e:
498+
except IOError as e:
499499
print " EXCEPTION: %s" % e
500500
raise
501501
else:
@@ -613,7 +613,7 @@ def debug(self, msg, *args): print msg % args
613613
def test(url, N=10):
614614
print "checking error hander (do this on a non-200)"
615615
try: error_handler(url)
616-
except IOError, e:
616+
except IOError as e:
617617
print "exiting - exception will prevent further tests"
618618
sys.exit()
619619
print

0 commit comments

Comments
 (0)