From d7227fbb7e07af35f23a0d370ab3b01661af9e40 Mon Sep 17 00:00:00 2001 From: Carson Lam Date: Sat, 17 Sep 2016 00:12:36 -0700 Subject: [PATCH] Add workaround to avoid implicit import of encodings.idna. --- requests/models.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/requests/models.py b/requests/models.py index 0f91b64e..b9a9d360 100644 --- a/requests/models.py +++ b/requests/models.py @@ -10,6 +10,11 @@ This module contains the primary objects that power Requests. import collections import datetime +# Import encoding now, to avoid implicit import later. +# Implicit import within threads may cause LookupError when standard library is in a ZIP, +# such as in Embedded Python. See https://github.com/kennethreitz/requests/issues/3578. +import encodings.idna + from io import BytesIO, UnsupportedOperation from .hooks import default_hooks from .structures import CaseInsensitiveDict