We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c5f3d69 commit 1a8c17aCopy full SHA for 1a8c17a
news/12769.bugfix.rst
@@ -0,0 +1 @@
1
+Gracefully handle Windows registry access errors while guessing the MIME type of a file.
src/pip/_internal/operations/prepare.py
@@ -87,7 +87,12 @@ class File:
87
88
def __post_init__(self) -> None:
89
if self.content_type is None:
90
- self.content_type = mimetypes.guess_type(self.path)[0]
+ # Try to guess the file's MIME type. If the system MIME tables
91
+ # can't be loaded, give up.
92
+ try:
93
+ self.content_type = mimetypes.guess_type(self.path)[0]
94
+ except OSError:
95
+ pass
96
97
98
def get_http_url(
0 commit comments