Skip to content

core: raise clear error when OpenSSL library is not found#318

Open
Bortlesboat wants to merge 1 commit intopetertodd:masterfrom
Bortlesboat:fix-windows-openssl-typeerror
Open

core: raise clear error when OpenSSL library is not found#318
Bortlesboat wants to merge 1 commit intopetertodd:masterfrom
Bortlesboat:fix-windows-openssl-typeerror

Conversation

@Bortlesboat
Copy link
Copy Markdown

On Windows, all four find_library() candidates can return None (ssl.35, ssl, libeay32, libcrypto). When that happens, None gets passed straight to ctypes.cdll.LoadLibrary(), which throws a confusing TypeError:

TypeError: LoadLibrary() argument 1 must be str, not NoneType

This checks the result before calling LoadLibrary() and raises an EnvironmentError with a message that actually tells you what's wrong.

Fixes #316

On Windows, ctypes.util.find_library() can return None for all
candidate library names. Passing None to LoadLibrary() raises a
confusing TypeError. Check for None first and raise an EnvironmentError
with an actionable message instead.

Fixes petertodd#316
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeError when OpenSSL library is not found on Windows

1 participant