def url2pathname(url):
 import string, urllib
 url = url.replace(':', '|')
 if (not ('|' in url)):
  if (url[:4] == '////'):
   url = url[2:]
  components = url.split('/')
  return urllib.unquote('\\'.join(components))
 comp = url.split('|')
 if ((len(comp) != 2) or (comp[0][(-1)] not in string.ascii_letters)):
  error = ('Bad URL: ' + url)
  raise IOError, error
 drive = comp[0][(-1)].upper()
 path = (drive + ':')
 components = comp[1].split('/')
 for comp in components:
  if comp:
   path = ((path + '\\') + urllib.unquote(comp))
 if (path.endswith(':') and url.endswith('/')):
  path += '\\'
 return path

def url2pathname ( url ) : import string , urllib url = url . replace ( ':' , '|' ) if ( not ( '|' in url ) ) : if ( url [ : 4 ] == '////' ) : url = url [ 2 : ] components = url . split ( '/' ) return urllib . unquote ( '\\' . join ( components ) ) comp = url . split ( '|' ) if ( ( len ( comp ) != 2 ) or ( comp [ 0 ] [ ( - 1 ) ] not in string . ascii_letters ) ) : error = ( 'Bad URL: ' + url ) raise IOError , error drive = comp [ 0 ] [ ( - 1 ) ] . upper ( ) path = ( drive + ':' ) components = comp [ 1 ] . split ( '/' ) for comp in components : if comp : path = ( ( path + '\\' ) + urllib . unquote ( comp ) ) if ( path . endswith ( ':' ) and url . endswith ( '/' ) ) : path += '\\' return path
os-specific conversion from a relative url of the file scheme to a file system path; not recommended for general use .