'OSError with Python asyncio on Github Actions with Windows [WinError 10106]
I have a .github/workflows/build.yml file for Github Actions that runs my tests on multiple OSs and multiple Python versions when I make a push or PR. The tests are written with pytest. I'm testing Python 3.7, 3.8, 3.9 and 3.10.
I'm using the responses module, which has a dependency on asyncio.
There's no problem running on Github Actions' platforms: macos-latest or ubuntu-latest for any Python version, or for windows-latest where the Python version is 3.7.
Using a Python version > 3.7 with windows-latest throws this OSError:
tests\util.py:12: in <module>
import responses
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\responses\__init__.py:38: in <module>
from unittest import mock as std_mock
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\unittest\__init__.py:60: in <module>
from .async_case import IsolatedAsyncioTestCase
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\unittest\async_case.py:1: in <module>
import asyncio
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\asyncio\__init__.py:41: in <module>
from .windows_events import *
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\asyncio\windows_events.py:3: in <module>
import _overlapped
E OSError: [WinError 10106] The requested service provider could not be loaded or initialized
I also get a lot of NameErrors related to asyncio that look like this:
tests\util.py:12: in <module>
import responses
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\site-packages\responses\__init__.py:38: in <module>
from unittest import mock as std_mock
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\unittest\__init__.py:60: in <module>
from .async_case import IsolatedAsyncioTestCase
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\unittest\async_case.py:1: in <module>
import asyncio
C:\hostedtoolcache\windows\Python\3.8.10\x64\lib\asyncio\__init__.py:26: in <module>
__all__ = (base_events.__all__ +
E NameError: name 'base_events' is not defined
Any help would be much appreciated!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
