def GetBaseDirectory(file, knowndir):
    fullpath = os.path.abspath(file)
    basedir = fullpath
    idx = string.find(basedir, knowndir)
    if idx == -1:
        raise Exception("File " + basedir + " not rooted under " + knowndir)
    return basedir[:idx]
dataset/ETHPy150Open kleientertainment/ds_mod_tools/pkg/unix/mod_tools/tools/scripts/pipelinetools.py/GetBaseDirectory/original