Skip to content

sockets and asyncio on Windows depend on SYSTEMROOT env var #118234

@jariwezerhu

Description

@jariwezerhu

Bug report

Bug description:

os.environ.clear() # THIS WAS THE CAUSE!!!
import asyncio

This causes the following:

Traceback (most recent call last):
  File "c:\Users\user\Documents\Development\main\main.py", line 3, in <module>
    import asyncio
  File "C:\Program Files\Python311\Lib\asyncio\__init__.py", line 42, in <module>
    from .windows_events import *
  File "C:\Program Files\Python311\Lib\asyncio\windows_events.py", line 8, in <module>
    import _overlapped
OSError: [WinError 10106] The requested service provider could not be loaded or initialized

It took me a whole day to figure out that os.environ.clear() causes this bug to occur. I'm not sure if this is supposed to occur, I just thought I would post this in case other people are struggling with this.

CPython versions tested on:

3.8, 3.9, 3.10, 3.11

Operating systems tested on:

Windows

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc direasy

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions