def path_to_url2(path):
 path = os.path.normpath(os.path.abspath(path))
 (drive, path) = os.path.splitdrive(path)
 filepath = path.split(os.path.sep)
 url = '/'.join([urllib.quote(part) for part in filepath])
 if (not drive):
  url = url.lstrip('/')
 return (('file:///' + drive) + url)

def path_to_url2 ( path ) : path = os . path . normpath ( os . path . abspath ( path ) ) ( drive , path ) = os . path . splitdrive ( path ) filepath = path . split ( os . path . sep ) url = '/' . join ( [ urllib . quote ( part ) for part in filepath ] ) if ( not drive ) : url = url . lstrip ( '/' ) return ( ( 'file:///' + drive ) + url )
convert a path to a file: url .