# HG changeset patch # User richardpenman # Date 1527001793 14400 # Node ID 06e9b88e0c20c94fd511351185b62cbfc26e64fd # Parent 7030835bcf5e102284d0f230081e50cb90ee04ab raise the import error exception when package is missing diff -r 7030835bcf5e -r 06e9b88e0c20 whois/whois.py --- a/whois/whois.py Tue May 08 08:47:28 2018 -0400 +++ b/whois/whois.py Tue May 22 11:09:53 2018 -0400 @@ -100,11 +100,10 @@ if "SOCKS" in os.environ: try: import socks - except Exception as e: - print(str(e)) - print("You need to install the Python socks module. Install PIP (https://bootstrap.pypa.io/get-pip.py). Then 'pip install PySocks' ") - sys.exit(0) - socksproxy,port = os.environ["SOCKS"].split(":") + except ImportError as e: + print("You need to install the Python socks module. Install PIP (https://bootstrap.pypa.io/get-pip.py) and then 'pip install PySocks'") + raise e + socksproxy, port = os.environ["SOCKS"].split(":") s = socks.socksocket() s.set_proxy(socks.SOCKS5, socksproxy, int(port)) else: