Skip to content

Ensurepip fails ungracefully when mimetype is missing from Windows registry  #100256

Closed

Description

@BlipRanger

Bug report

A "WinError 5 Access is denied" error occurs when ensurepip (for python 3.10 and above) is run and there are missing/inaccessible mimetypes in the Windows registry. Because ensurepip is used in the Python installer, it also fails silently there, causing pip to never be installed without alerting the user to the issue. The line in which the error occurs is here:

_mimetypes_read_windows_registry(add_type)

Bypassing that line and instead using self._read_windows_registry(add_type) (which is the fallback function I believe) fixes the problem. I believe that _mimetypes_read_windows_registry(add_type) needs to be able to fail more gracefully when it can't find a particular mimetype in the registry.
I found someone else describing exactly the issue here.

Your environment

  • CPython versions tested on: 3.10, 3.11
  • Operating system and architecture: Windows 10 LTSC, x64

Linked PRs

Activity

  1. huanghe2015 commented on Aug 4, 2023

    @huanghe2015

    Same thing happened with me ,Patrick and Stackoverflow.

  2. added
    3.13only security fixes
    3.14bugs and security fixes
    triagedThe issue has been accepted as valid by a triager.
    and removed
    3.11only security fixes
    on Jun 18, 2024
  3. added 3 commits that reference this issue on Jul 19, 2024
  4. LucasEsposito commented on Jul 19, 2024

    @LucasEsposito
    Contributor

    Opened a PR to address this issue

  5. added 2 commits that reference this issue on Jul 21, 2024
  6. added a commit that references this issue on Aug 7, 2024
  7. added 2 commits that reference this issue on Aug 7, 2024
  8. added a commit that references this issue on Aug 7, 2024
  9. added a commit that references this issue on Aug 22, 2024
  10. added a commit that references this issue on Sep 2, 2024
  11. hugovk commented on Nov 18, 2024

    @hugovk
    Member

    Triage: Closing, PRs have been merged and backported.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.12only security fixes3.13only security fixes3.14bugs and security fixesOS-windowseasyextension-modulesC modules in the Modules dirtopic-ensurepiptriagedThe issue has been accepted as valid by a triager.type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions