

def get_virtualenv_path(ve_base, ve_name):
    'Check a virtualenv path, raising exceptions to explain problems.\n    '
    if (not ve_base):
        raise exceptions.NoVirtualenvsDirectory('could not figure out a virtualenvs directory. make sure $HOME is set, or $WORKON_HOME, or set virtualenvs=something in your .vexrc')
    if (not os.path.exists(ve_base)):
        message = 'virtualenvs directory {0!r} not found. Create it or use vex --make to get started.'.format(ve_base)
        raise exceptions.NoVirtualenvsDirectory(message)
    if (not ve_name):
        raise exceptions.InvalidVirtualenv('no virtualenv name')
    ve_path = os.path.join(ve_base, ve_name)
    if ((ve_path == ve_name) and (os.path.basename(ve_name) != ve_name)):
        raise exceptions.InvalidVirtualenv('To run in a virtualenv by its path, use "vex --path {0}"'.format(ve_path))
    ve_path = os.path.abspath(ve_path)
    if (not os.path.exists(ve_path)):
        raise exceptions.InvalidVirtualenv('no virtualenv found at {0!r}.'.format(ve_path))
    return ve_path

dataset/ETHPy150Open sashahart/vex/vex/main.py get_virtualenv_path/original