Trying to get imports working with both Python 2 and 3

This commit is contained in:
Michael Hansen
2013-10-28 10:29:20 -04:00
parent 1d6531aa04
commit 522778b214
+17 -3
View File
@@ -10,9 +10,23 @@ from skimage.transform import resize
from skimage.color import color_dict
from skimage._shared import six
from six.moves.urllib_parse import urlparse
from six.moves.urllib import request
urlopen = request.urlopen
try:
from urlparse import urlparse
except ImportError:
try:
from urllib import parse as urlparse
except ImportError:
from six.moves.urllib_parse import urlparse
try:
from urllib2 import urlopen
except ImportError:
try:
from urllib import request
urlopen = request.urlopen
except ImportError:
from six.moves.urllib import request
urlopen = request.urlopen
# Convert colors from `skimage.color` to uint8 and allow access through