raise Exception(...)

This commit is contained in:
j 2016-06-04 00:39:01 +02:00
parent 7695a9c015
commit 1e3d2d24bb
2 changed files with 5 additions and 5 deletions

View file

@ -53,8 +53,8 @@ def decode_dict(x, f):
lastkey = None
while x[f] != 'e':
k, f = decode_string(x, f)
#why is this needed
#if lastkey >= k:
# why is this needed
# if lastkey >= k:
# raise ValueError
lastkey = k
r[k], f = decode_func[x[f]](x, f)
@ -81,9 +81,9 @@ def bdecode(x, sloppy = 1):
r, l = decode_func[x[0]](x, 0)
# except (IndexError, KeyError):
except (IndexError, KeyError, ValueError):
raise ValueError, "bad bencoded data"
raise ValueError("bad bencoded data")
if not sloppy and l != len(x):
raise ValueError, "bad bencoded data"
raise ValueError("bad bencoded data")
return r
def test_bdecode():

View file

@ -17,7 +17,7 @@ def get(key):
if key in auth:
return auth[key]
print("please add key %s to json file '%s'" % (key, user_auth))
raise Exception,"no key %s found" % key
raise Exception("no key %s found" % key)
def update(key, value):
user_auth = os.environ.get('oxAUTH', os.path.expanduser('~/.ox/auth.json'))