aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ez_setup.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/ez_setup.py b/ez_setup.py
index a05069b2..4c78d852 100644
--- a/ez_setup.py
+++ b/ez_setup.py
@@ -27,6 +27,11 @@ import contextlib
from distutils import log
try:
+ from urllib.request import urlopen
+except ImportError:
+ from urllib2 import urlopen
+
+try:
from site import USER_SITE
except ImportError:
USER_SITE = None
@@ -227,10 +232,6 @@ def download_file_insecure(url, target):
Use Python to download the file, even though it cannot authenticate the
connection.
"""
- try:
- from urllib.request import urlopen
- except ImportError:
- from urllib2 import urlopen
src = urlopen(url)
try:
# Read all the data in one block.