summaryrefslogtreecommitdiff
path: root/numpy/lib/_datasource.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/_datasource.py')
-rw-r--r--numpy/lib/_datasource.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/lib/_datasource.py b/numpy/lib/_datasource.py
index db97c5507..9f0bb1ae8 100644
--- a/numpy/lib/_datasource.py
+++ b/numpy/lib/_datasource.py
@@ -36,6 +36,7 @@ from __future__ import division, absolute_import
__docformat__ = "restructuredtext en"
import os
+import sys
from shutil import rmtree, copyfile, copyfileobj
_open = open
@@ -252,7 +253,10 @@ class DataSource (object):
"""Test if path is a net location. Tests the scheme and netloc."""
# We do this here to reduce the 'import numpy' initial import time.
- from urlparse import urlparse
+ if sys.version_info[0] >= 3:
+ from urllib.parse import urlparse
+ else:
+ from urlparse import urlparse
# BUG : URLs require a scheme string ('http://') to be used.
# www.google.com will fail.
@@ -351,8 +355,10 @@ class DataSource (object):
"""
# We do this here to reduce the 'import numpy' initial import time.
- from urlparse import urlparse
-
+ if sys.version_info[0] >= 3:
+ from urllib.parse import urlparse
+ else:
+ from urlparse import urlparse
# TODO: This should be more robust. Handles case where path includes
# the destpath, but not other sub-paths. Failing case: