def ExecuteOrImportScript(config, handler_path, cgi_path, import_hook):
  module_fullname, script_module, module_code = LoadTargetModule(
      handler_path, cgi_path, import_hook)
  script_module.__name__ = '__main__'
  sys.modules['__main__'] = script_module
  try:

    import pdb
    MonkeyPatchPdb(pdb)


    if module_code:
      exec module_code in script_module.__dict__
    else:
      script_module.main()





    sys.stdout.flush()
    sys.stdout.seek(0)
    try:
      headers = mimetools.Message(sys.stdout)
    finally:


      sys.stdout.seek(0, 2)
    status_header = headers.get('status')
    error_response = False
    if status_header:
      try:
        status_code = int(status_header.split(' ', 1)[0])
        error_response = status_code >= 400
      except ValueError:
        error_response = True


    if not error_response:
      try:
        parent_package = import_hook.GetParentPackage(module_fullname)
      except Exception:
        parent_package = None

      if parent_package is not None:
        submodule = GetSubmoduleName(module_fullname)
        setattr(parent_package, submodule, script_module)

    return error_response
  finally:
    script_module.__name__ = module_fullname
Verify inferring page titles based on the filename
dataset/ETHPy150Open AppScale/appscale/AppServer/google/appengine/tools/dev_appserver.py/ExecuteOrImportScript--crossover with--dataset/ETHPy150Open mkdocs/mkdocs/mkdocs/tests/nav_tests.py/SiteNavigationTests.test_generate_site_navigation