def path_make_relative(path): p = relpath(path) if p[-1] == os.path.sep: return p else: return p + os.path.sep