def run_rc_file(editor, rc_file):
    assert isinstance(editor, Editor)
    assert isinstance(rc_file, six.string_types)

    # Expand tildes.
    rc_file = os.path.expanduser(rc_file)

    # Check whether this file exists.
    if not os.path.exists(rc_file):
        print('Impossible to read %r' % rc_file)
        _press_enter_to_continue()
        return

    # Run the rc file in an empty namespace.
    try:
        namespace = {}

        with open(rc_file, 'r') as f:
            code = compile(f.read(), rc_file, 'exec')
            six.exec_(code, namespace, namespace)

        # Now we should have a 'configure' method in this namespace. We call this
        # method with editor as an argument.
        if 'configure' in namespace:
            namespace['configure'](editor)

    except Exception as e:
        # Handle possible exceptions in rc file.
        traceback.print_exc()
        _press_enter_to_continue()
Run rc file.
dataset/ETHPy150Open jonathanslenders/pyvim/pyvim/rc_file.py/run_rc_file