mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-25 17:09:02 +00:00
Old exception handling format to new one
This commit is contained in:
2
thirdparty/beautifulsoup/beautifulsoup.py
vendored
2
thirdparty/beautifulsoup/beautifulsoup.py
vendored
@@ -1836,7 +1836,7 @@ class UnicodeDammit:
|
||||
u = self._toUnicode(markup, proposed)
|
||||
self.markup = u
|
||||
self.originalEncoding = proposed
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
# print "That didn't work!"
|
||||
# print e
|
||||
return None
|
||||
|
||||
4
thirdparty/clientform/clientform.py
vendored
4
thirdparty/clientform/clientform.py
vendored
@@ -1100,7 +1100,7 @@ def _ParseFileEx(file, base_uri,
|
||||
data = file.read(CHUNK)
|
||||
try:
|
||||
fp.feed(data)
|
||||
except ParseError, e:
|
||||
except ParseError as e:
|
||||
e.base_uri = base_uri
|
||||
raise
|
||||
if len(data) != CHUNK: break
|
||||
@@ -2902,7 +2902,7 @@ class HTMLForm:
|
||||
control = self.find_control(name)
|
||||
try:
|
||||
control.value = value
|
||||
except AttributeError, e:
|
||||
except AttributeError as e:
|
||||
raise ValueError(str(e))
|
||||
|
||||
def get_value(self,
|
||||
|
||||
2
thirdparty/colorama/ansitowin32.py
vendored
2
thirdparty/colorama/ansitowin32.py
vendored
@@ -180,7 +180,7 @@ class AnsiToWin32(object):
|
||||
def _write(self, text, retry=5):
|
||||
try:
|
||||
self.wrapped.write(text)
|
||||
except IOError, err:
|
||||
except IOError as err:
|
||||
if not (err.errno == 0 and retry > 0):
|
||||
raise
|
||||
self._write(text, retry-1)
|
||||
|
||||
2
thirdparty/gprof2dot/gprof2dot.py
vendored
2
thirdparty/gprof2dot/gprof2dot.py
vendored
@@ -695,7 +695,7 @@ class XmlTokenizer:
|
||||
self.final = len(data) < size
|
||||
try:
|
||||
self.parser.Parse(data, self.final)
|
||||
except xml.parsers.expat.ExpatError, e:
|
||||
except xml.parsers.expat.ExpatError as e:
|
||||
#if e.code == xml.parsers.expat.errors.XML_ERROR_NO_ELEMENTS:
|
||||
if e.code == 3:
|
||||
pass
|
||||
|
||||
8
thirdparty/keepalive/keepalive.py
vendored
8
thirdparty/keepalive/keepalive.py
vendored
@@ -238,7 +238,7 @@ class KeepAliveHandler:
|
||||
self._cm.add(host, h, 0)
|
||||
self._start_transaction(h, req)
|
||||
r = h.getresponse()
|
||||
except (socket.error, httplib.HTTPException), err:
|
||||
except (socket.error, httplib.HTTPException) as err:
|
||||
raise urllib2.URLError(err)
|
||||
|
||||
if DEBUG: DEBUG.info("STATUS: %s, %s", r.status, r.reason)
|
||||
@@ -323,7 +323,7 @@ class KeepAliveHandler:
|
||||
h.putrequest(req.get_method() or 'GET', req.selector, skip_host=req.has_header("Host"), skip_accept_encoding=req.has_header("Accept-encoding"))
|
||||
else:
|
||||
h.putrequest(req.get_method() or 'GET', req.get_selector(), skip_host=req.has_header("Host"), skip_accept_encoding=req.has_header("Accept-encoding"))
|
||||
except (socket.error, httplib.HTTPException), err:
|
||||
except (socket.error, httplib.HTTPException) as err:
|
||||
raise urllib2.URLError(err)
|
||||
|
||||
if not req.headers.has_key('Connection'):
|
||||
@@ -495,7 +495,7 @@ def error_handler(url):
|
||||
fo.close()
|
||||
try: status, reason = fo.status, fo.reason
|
||||
except AttributeError: status, reason = None, None
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
print " EXCEPTION: %s" % e
|
||||
raise
|
||||
else:
|
||||
@@ -613,7 +613,7 @@ def test_timeout(url):
|
||||
def test(url, N=10):
|
||||
print "checking error hander (do this on a non-200)"
|
||||
try: error_handler(url)
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
print "exiting - exception will prevent further tests"
|
||||
sys.exit()
|
||||
print
|
||||
|
||||
Reference in New Issue
Block a user