Initial port to python3
[htsworkflow.git] / htsworkflow / util / opener.py
index 035bb24dabc9cc43d2f9ae10a3fe8562243230fd..ab83146d39604b1588301b7e016166721d889692 100644 (file)
@@ -5,7 +5,7 @@ import os
 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?
@@ -47,7 +47,7 @@ def autoopen(file_ref, mode='r'):
     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':