import gzip
import bz2
import types
-import urllib2
+import urllib.request, urllib.error, urllib.parse
def isfilelike(file_ref, mode):
"""Does file_ref have the core file operations?
elif isfilelike(file_ref, mode):
return file_ref
elif isurllike(file_ref, mode):
- return urllib2.urlopen(file_ref)
+ return urllib.request.urlopen(file_ref)
elif os.path.splitext(file_ref)[1] == ".gz":
return gzip.open(file_ref, mode)
elif os.path.splitext(file_ref)[1] == '.bz2':