Can't dynamically import httpx anymore #698
Unanswered
MarieSaphira
asked this question in
Potential Issue
Replies: 2 comments 7 replies
-
It appears to be a problem with httpcore. |
Beta Was this translation helpful? Give feedback.
6 replies
-
The function This code also fails with the same exception. import threading
from importlib import import_module
from time import sleep
def thread_function():
sleep(0.5)
threading._register_atexit(lambda: ...)
if __name__ == "__main__":
x = threading.Thread(target=thread_function)
x.start() or this one import threading
def thread_function():
import anyio
if __name__ == "__main__":
x = threading.Thread(target=thread_function)
x.start() I believe that since this isn't an issue at all, fixing it in httpcore makes no sense. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Since the update of
httpcore
to 1.17.2 yesterday, it's not possible to dynamically importhttpx
in a thread anymore. They changed some imports from lazy to conditional (see this pull request).Example
throws a
RuntimeError: can't register atexit after shutdown
Workaround
Explicitly install
httpcore=0.17.1
Remark
Sorry if this is not the right place to start this discussion, maybe this should be discussed in
httpcore
instead?Beta Was this translation helpful? Give feedback.
All reactions