File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change 1010import  copy 
1111import  pprint 
1212from  StringIO  import  StringIO 
13- import  pathlib2  as  pathlib 
13+ try :
14+     # python 3 
15+     import  pathlib 
16+ except :
17+     # python 2 
18+     import  pathlib2  as  pathlib 
1419
1520from  . import  validate 
1621from  .aslist  import  aslist 
@@ -110,7 +115,7 @@ def fetch_text(self, url):
110115            return  resp .text 
111116        elif  scheme  ==  'file' :
112117            try :
113-                 with  open (urllib .url2pathname (urlparse .urlparse (url ).path )) as  fp :
118+                 with  open (urllib .url2pathname (str ( urlparse .urlparse (url ).path ) )) as  fp :
114119                    read  =  fp .read ()
115120                if  hasattr (read , "decode" ):
116121                    return  read .decode ("utf-8" )
@@ -139,7 +144,7 @@ def check_exists(self, url):  # type: (unicode) -> bool
139144                return  False 
140145            return  True 
141146        elif  scheme  ==  'file' :
142-             return  os .path .exists (urllib .url2pathname (urlparse .urlparse (url ).path ))
147+             return  os .path .exists (urllib .url2pathname (str ( urlparse .urlparse (url ).path ) ))
143148        else :
144149            raise  ValueError ('Unsupported scheme in url: %s'  %  url )
145150
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments