def path_to_url(path):
 path = os.path.normcase(os.path.abspath(path))
 if _drive_re.match(path):
  path = ((path[0] + '|') + path[2:])
 url = urllib.quote(path)
 url = url.replace(os.path.sep, '/')
 url = url.lstrip('/')
 return ('file:///' + url)

def path_to_url ( path ) : path = os . path . normcase ( os . path . abspath ( path ) ) if _drive_re . match ( path ) : path = ( ( path [ 0 ] + '|' ) + path [ 2 : ] ) url = urllib . quote ( path ) url = url . replace ( os . path . sep , '/' ) url = url . lstrip ( '/' ) return ( 'file:///' + url )
convert a system path to a url .