[pypy-commit] pypy default: (cfbolz, arigo around) attach error to exception

cfbolz pypy.commits at gmail.com
Wed Oct 23 09:36:07 EDT 2019


Author: Carl Friedrich Bolz-Tereick <cfbolz at gmx.de>
Branch: 
Changeset: r97839:b6cf80ef9029
Date: 2019-10-23 15:35 +0200
http://bitbucket.org/pypy/pypy/changeset/b6cf80ef9029/

Log:	(cfbolz, arigo around) attach error to exception

diff --git a/lib_pypy/_cffi_ssl/_stdssl/__init__.py b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
--- a/lib_pypy/_cffi_ssl/_stdssl/__init__.py
+++ b/lib_pypy/_cffi_ssl/_stdssl/__init__.py
@@ -6,14 +6,13 @@
 try:
     from _pypy_openssl import ffi
     from _pypy_openssl import lib
-except ImportError:
+except ImportError as e:
     import os
-    print("The _ssl cffi module either doesn't exist or is incompatible with your machine's shared libraries.")
-    print("If you have a compiler installed, you can try to rebuild it by running:")
-    print("cd %s" % os.path.abspath(os.path.dirname(os.path.dirname(__file__))))
-    print("%s _ssl_build.py" % sys.executable)
-    print()
-    raise
+    msg = "\n\nThe _ssl cffi module either doesn't exist or is incompatible with your machine's shared libraries.\n" + \
+          "If you have a compiler installed, you can try to rebuild it by running:\n" + \
+          "cd %s\n" % os.path.abspath(os.path.dirname(os.path.dirname(__file__))) + \
+          "%s _ssl_build.py\n" % sys.executable
+    raise ImportError(str(e) + msg)
 
 from _cffi_ssl._stdssl.certificate import (_test_decode_cert,
     _decode_certificate, _certificate_to_der)


More information about the pypy-commit mailing list