Skip to content

Commit d3f1c59

Browse files
committed
Updated other instances where Exceptions needed to be indexed into.
1 parent e42238f commit d3f1c59

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

mbed/mbed.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,10 @@ def popen(command, stdin=None, **kwargs):
218218
try:
219219
proc = subprocess.Popen(command, **kwargs)
220220
except OSError as e:
221-
if e[0] == errno.ENOENT:
221+
if e.args[0] == errno.ENOENT:
222222
error(
223223
"Could not execute \"%s\".\n"
224-
"Please verify that it's installed and accessible from your current path by executing \"%s\".\n" % (command[0], command[0]), e[0])
224+
"Please verify that it's installed and accessible from your current path by executing \"%s\".\n" % (command[0], command[0]), e.args[0])
225225
else:
226226
raise e
227227

@@ -234,10 +234,10 @@ def pquery(command, output_callback=None, stdin=None, **kwargs):
234234
try:
235235
proc = subprocess.Popen(command, bufsize=0, stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
236236
except OSError as e:
237-
if e[0] == errno.ENOENT:
237+
if e.args[0] == errno.ENOENT:
238238
error(
239239
"Could not execute \"%s\".\n"
240-
"Please verify that it's installed and accessible from your current path by executing \"%s\".\n" % (command[0], command[0]), e[0])
240+
"Please verify that it's installed and accessible from your current path by executing \"%s\".\n" % (command[0], command[0]), e.args[0])
241241
else:
242242
raise e
243243

@@ -353,7 +353,7 @@ def clone(url, path=None, depth=None, protocol=None):
353353
except Exception as e:
354354
if os.path.isdir(path):
355355
rmtree_readonly(path)
356-
error(e[1], e[0])
356+
error(e.args[1], e.args[0])
357357

358358
def fetch_rev(url, rev):
359359
rev_file = os.path.join('.'+Bld.name, '.rev-' + rev + '.zip')
@@ -400,7 +400,7 @@ def checkout(rev, clean=False):
400400
Bld.unpack_rev(rev)
401401
Bld.seturl(url+'/'+rev)
402402
except Exception as e:
403-
error(e[1], e[0])
403+
error(e.args[1], e.args[0])
404404

405405
def update(rev=None, clean=False, clean_files=False, is_local=False):
406406
return Bld.checkout(rev, clean)
@@ -2000,8 +2000,7 @@ def import_(url, path=None, ignore=False, depth=None, protocol=None, insecure=Fa
20002000
if ignore:
20012001
warning(err)
20022002
else:
2003-
print("HI")
2004-
error(err, e[0])
2003+
error(err, e.args[0])
20052004
else:
20062005
err = "Unable to clone repository (%s)" % url
20072006
if ignore:
@@ -2152,7 +2151,7 @@ def publish(all_refs=None, msg=None, top=True):
21522151
if top:
21532152
action("Nothing to publish to the remote repository (the source tree is unmodified)")
21542153
except ProcessException as e:
2155-
if e[0] != 1:
2154+
if e.args[0] != 1:
21562155
raise e
21572156

21582157

@@ -2219,7 +2218,7 @@ def update(rev=None, clean=False, clean_files=False, clean_deps=False, ignore=Fa
22192218
if ignore:
22202219
warning(err)
22212220
else:
2222-
error(err, e[0])
2221+
error(err, e.args[0])
22232222

22242223
repo.rm_untracked()
22252224
if top and cwd_type == 'library':
@@ -2993,14 +2992,14 @@ def main():
29932992
except ProcessException as e:
29942993
error(
29952994
"\"%s\" returned error code %d.\n"
2996-
"Command \"%s\" in \"%s\"" % (e[1], e[0], e[2], e[3]), e[0])
2995+
"Command \"%s\" in \"%s\"" % (e.args[1], e.args[0], e.args[2], e.args[3]), e.args[0])
29972996
except OSError as e:
2998-
if e[0] == errno.ENOENT:
2997+
if e.args[0] == errno.ENOENT:
29992998
error(
30002999
"Could not detect one of the command-line tools.\n"
3001-
"You could retry the last command with \"-v\" flag for verbose output\n", e[0])
3000+
"You could retry the last command with \"-v\" flag for verbose output\n", e.args[0])
30023001
else:
3003-
error('OS Error: %s' % e[1], e[0])
3002+
error('OS Error: %s' % e.args[1], e.args[0])
30043003
except KeyboardInterrupt:
30053004
info('User aborted!', -1)
30063005
sys.exit(255)

0 commit comments

Comments
 (0)