From aae75a3d3f81aaa8a6bfadb5885b936ec2db59da Mon Sep 17 00:00:00 2001 From: "Jason R. Coombs" Date: Sat, 17 May 2014 20:04:40 -0400 Subject: Move import to the top --- ez_setup.py | 9 +++++---- 1 file 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 @@ -26,6 +26,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: @@ -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. -- cgit v1.2.1