diff --git a/setuptools/command/upload_docs.py b/setuptools/command/upload_docs.py index 27c98b7c30..32c9abd796 100644 --- a/setuptools/command/upload_docs.py +++ b/setuptools/command/upload_docs.py @@ -8,7 +8,6 @@ from distutils import log from distutils.errors import DistutilsOptionError import os -import socket import zipfile import tempfile import shutil @@ -201,7 +200,7 @@ def upload_file(self, filename): conn.putheader('Authorization', auth) conn.endheaders() conn.send(body) - except socket.error as e: + except OSError as e: self.announce(str(e), log.ERROR) return diff --git a/setuptools/package_index.py b/setuptools/package_index.py index 7095585008..3cedd5105c 100644 --- a/setuptools/package_index.py +++ b/setuptools/package_index.py @@ -806,7 +806,7 @@ def open_url(self, url, warning=None): # noqa: C901 # is too complex (12) '%s returned a bad status line. The server might be ' 'down, %s' % (url, v.line) ) from v - except (http.client.HTTPException, socket.error) as v: + except (http.client.HTTPException, OSError) as v: if warning: self.warn(warning, v) else: