def safe_execfile(self, fname, *where, exit_ignore=False, raise_exceptions=False, shell_futures=False):
    'A safe version of the builtin execfile().\n\n        This version will never throw an exception, but instead print\n        helpful error messages to the screen.  This only works on pure\n        Python files with the .py extension.\n\n        Parameters\n        ----------\n        fname : string\n            The name of the file to be executed.\n        *where : tuple\n            One or two namespaces, passed to execfile() as (globals,locals).\n            If only one is given, it is passed as both.\n        exit_ignore : bool (False)\n            If True, then silence SystemExit for non-zero status (it is always\n            silenced for zero status, as it is so common).\n        raise_exceptions : bool (False)\n            If True raise exceptions everywhere. Meant for testing.\n        shell_futures : bool (False)\n            If True, the code will share future statements with the interactive\n            shell. It will both be affected by previous __future__ imports, and\n            any __future__ imports in the code will affect the shell. If False,\n            __future__ imports are not shared in either direction.\n\n        '
    fname = Path(fname).expanduser().resolve()
    try:
        with fname.open('rb'):
            pass
    except:
        warn(('Could not open file <%s> for safe execution.' % fname))
        return
    dname = str(fname.parent)
    with prepended_to_syspath(dname), self.builtin_trap:
        try:
            (glob, loc) = (where + (None,))[:2]
            py3compat.execfile(fname, glob, loc, (self.compile if shell_futures else None))
        except SystemExit as status:
            if status.code:
                if raise_exceptions:
                    raise
                if (not exit_ignore):
                    self.showtraceback(exception_only=True)
        except:
            if raise_exceptions:
                raise
            self.showtraceback(tb_offset=2)
A safe version of the builtin execfile().

This version will never throw an exception, but instead print
helpful error messages to the screen.  This only works on pure
Python files with the .py extension.

Parameters
----------
fname : string
    The name of the file to be executed.
*where : tuple
    One or two namespaces, passed to execfile() as (globals,locals).
    If only one is given, it is passed as both.
exit_ignore : bool (False)
    If True, then silence SystemExit for non-zero status (it is always
    silenced for zero status, as it is so common).
raise_exceptions : bool (False)
    If True raise exceptions everywhere. Meant for testing.
shell_futures : bool (False)
    If True, the code will share future statements with the interactive
    shell. It will both be affected by previous __future__ imports, and
    any __future__ imports in the code will affect the shell. If False,
    __future__ imports are not shared in either direction.
def safe_execfile(self, fname, *where, exit_ignore=False, raise_exceptions=False, shell_futures=False):
    'A safe version of the builtin execfile().\n\n        This version will never throw an exception, but instead print\n        helpful error messages to the screen.  This only works on pure\n        Python files with the .py extension.\n\n        Parameters\n        ----------\n        fname : string\n            The name of the file to be executed.\n        *where : tuple\n            One or two namespaces, passed to execfile() as (globals,locals).\n            If only one is given, it is passed as both.\n        exit_ignore : bool (False)\n            If True, then silence SystemExit for non-zero status (it is always\n            silenced for zero status, as it is so common).\n        raise_exceptions : bool (False)\n            If True raise exceptions everywhere. Meant for testing.\n        shell_futures : bool (False)\n            If True, the code will share future statements with the interactive\n            shell. It will both be affected by previous __future__ imports, and\n            any __future__ imports in the code will affect the shell. If False,\n            __future__ imports are not shared in either direction.\n\n        '
    fname = Path(fname).expanduser().resolve()
    try:
        with fname.open('rb'):
            pass
    except:
        warn(('Could not open file <%s> for safe execution.' % fname))
        return
    dname = str(fname.parent)
    with prepended_to_syspath(dname), self.builtin_trap:
        try:
            (glob, loc) = (where + (None,))[:2]
            py3compat.execfile(fname, glob, loc, (self.compile if shell_futures else None))
        except SystemExit as status:
            if status.code:
                if raise_exceptions:
                    raise
                if (not exit_ignore):
                    self.showtraceback(exception_only=True)
        except:
            if raise_exceptions:
                raise
            self.showtraceback(tb_offset=2)