def repl_absolute(m, base_path):
 link = m.group(0)
 try:
  (scheme, netloc, path, params, query, fragment, is_url, is_absolute) = parse_url(m.group('path')[1:(-1)])
  if ((not is_absolute) and (not is_url)):
   path = url2pathname(path)
   temp = os.path.normpath(os.path.join(base_path, path))
   if os.path.exists(temp):
    path = pathname2url(temp.replace('\\', '/'))
    link = ('%s"%s"' % (m.group('name'), urlunparse((scheme, netloc, path, params, query, fragment))))
 except Exception:
  pass
 return link

def repl_absolute ( m , base_path ) : link = m . group ( 0 ) try : ( scheme , netloc , path , params , query , fragment , is_url , is_absolute ) = parse_url ( m . group ( 'path' ) [ 1 : ( - 1 ) ] ) if ( ( not is_absolute ) and ( not is_url ) ) : path = url2pathname ( path ) temp = os . path . normpath ( os . path . join ( base_path , path ) ) if os . path . exists ( temp ) : path = pathname2url ( temp . replace ( '\\' , '/' ) ) link = ( '%s"%s"' % ( m . group ( 'name' ) , urlunparse ( ( scheme , netloc , path , params , query , fragment ) ) ) ) except Exception : pass return link
replace path with absolute path .