Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved exception handling when importing the module (#596)
The current expection handling is too vague, and in certain circumstances, the error message may confuse the user. For example, if an error occurs while importing the "_mysql" module, the original error message is as follows: ``` File "MySQLdb/__init__.py", line 18, in <module> from . import _mysql ImportError: /lib64/libstdc++.so.6: cannot allocate memory in static TLS block ``` But on the user side, he can only see the exception message like this: ``` /MySQLdb/__init__.py", line 24, in <module> version_info, _mysql.version_info, _mysql.__file__ NameError: name '_mysql' is not defined ``` This PR fixes this issue by making the exception handling statements more precise.
- Loading branch information