class_docstr: A Mixin for applications that start InteractiveShell instances.
  
  Provides configurables for loading extensions and executing files
  as part of configuring a Shell environment.
  
  The following methods should be called by the :meth:`initialize` method
  of the subclass:
  
    - :meth:`init_path`
    - :meth:`init_shell` (to be implemented by the subclass)
    - :meth:`init_gui_pylab`
    - :meth:`init_extensions`
    - :meth:`init_code`
code: def _exec_file(self, fname, shell_futures=False):
      try:
          full_filename = filefind(fname, [".", self.ipython_dir])
      except IOError:
          self.log.warning("File not found: %r" % fname)
          return
      # Make sure that the running script gets a proper sys.argv as if it
      # were run from a system shell.
      save_argv = sys.argv
      sys.argv = [full_filename] + self.extra_args[1:]
      # protect sys.argv from potential unicode strings on Python 2:
      if not py3compat.PY3:
          sys.argv = [py3compat.cast_bytes(a) for a in sys.argv]
      try:
          if os.path.isfile(full_filename):
              self.log.info(
                  "Running file in user namespace: %s" % full_filename
              )
              # Ensure that __file__ is always defined to match Python
              # behavior.
              with preserve_keys(self.shell.user_ns, "__file__"):
                  self.shell.user_ns["__file__"] = fname
                  if full_filename.endswith(".ipy"):
                      self.shell.safe_execfile_ipy(
                          full_filename, shell_futures=shell_futures
                      )
                  else:
                      # default to python, even without extension
                      self.shell.safe_execfile(
                          full_filename,
                          self.shell.user_ns,
                          shell_futures=shell_futures,
                          raise_exceptions=True,
                      )
      finally:
          sys.argv = save_argv
  
imports: from __future__ import absolute_import
  from __future__ import print_function
  import glob
  from itertools import chain
  import os
  import sys
  from traitlets.config.application import boolean_flag
  from traitlets.config.configurable import Configurable
  from traitlets.config.loader import Config
  from IPython.core.application import SYSTEM_CONFIG_DIRS, ENV_CONFIG_DIRS
  from IPython.core import pylabtools
  from IPython.utils import py3compat
  from IPython.utils.contexts import preserve_keys
  from IPython.utils.path import filefind
  from traitlets import Unicode, Instance, List, Bool, CaselessStrEnum, observe
  from IPython.terminal import pt_inputhooks
label_desc: Use image node_id 8 for calling the InteractiveShellApp obj's underlying member method code with example usage: obj._exec_file(fname, shell_futures) without return types