From be9682a29632257842384b0cecca6b9b6475216c Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Sun, 20 Oct 2013 08:23:52 -0400 Subject: Except clause can now use 'as', no need for lots of sys.exc_info --- setup.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'setup.py') diff --git a/setup.py b/setup.py index 215102b..e8780f3 100644 --- a/setup.py +++ b/setup.py @@ -144,9 +144,9 @@ class ve_build_ext(build_ext): build_ext.build_extension(self, ext) except ext_errors: raise BuildFailed() - except ValueError: + except ValueError as err: # this can happen on Windows 64 bit, see Python issue 7511 - if "'path'" in str(sys.exc_info()[1]): # works with both py 2/3 + if "'path'" in str(err): # works with both py 2/3 raise BuildFailed() raise @@ -186,9 +186,8 @@ def main(): # extension. Try it with, and if it fails, try it without. try: setup(**setup_args) - except BuildFailed: + except BuildFailed as exc: msg = "Couldn't install with extension module, trying without it..." - exc = sys.exc_info()[1] exc_msg = "%s: %s" % (exc.__class__.__name__, exc.cause) print("**\n** %s\n** %s\n**" % (msg, exc_msg)) -- cgit v1.2.1