def relativeTo(base, relativee):
 basepath = os.path.abspath(base)
 relativee = os.path.abspath(relativee)
 if relativee.startswith(basepath):
  relative = relativee[len(basepath):]
  if relative.startswith(os.sep):
   relative = relative[1:]
  return os.path.join(base, relative)
 raise ValueError(('%s is not a subpath of %s' % (relativee, basepath)))

def relativeTo ( base , relativee ) : basepath = os . path . abspath ( base ) relativee = os . path . abspath ( relativee ) if relativee . startswith ( basepath ) : relative = relativee [ len ( basepath ) : ] if relative . startswith ( os . sep ) : relative = relative [ 1 : ] return os . path . join ( base , relative ) raise ValueError ( ( '%s is not a subpath of %s' % ( relativee , basepath ) ) )
gets relativee relative to basepath .