def get_ipdir():
    """Get IPython directory from command line, or assume it's the one above."""

    # Initialize arguments and check location
    try:
        ipdir = sys.argv[1]
    except IndexError:
        ipdir = '..'

    ipdir = os.path.abspath(ipdir)

    cd(ipdir)
    if not os.path.isdir('IPython') and os.path.isfile('setup.py'):
        raise SystemExit('Invalid ipython directory: %s' % ipdir)
    return ipdir
dataset/ETHPy150Open ipython/ipython-py3k/tools/toollib.py/get_ipdir/original