parameters: (error)
return_statement: return ImportError(full_error_msg)
docstring: Called when the module fails to import "internals".
      Returns ImportError with some debugging message.
docstring_summary: Called when the module fails to import "internals".
      Returns ImportError with some debugging message.
docstring_tokens: Called when the module fails to import internals . Returns ImportError with some debugging message .
function: def debug_load_error(error):
      """Called when the module fails to import "internals".
      Returns ImportError with some debugging message.
      """
      # Try to load just the version.py
      version_imported = True
      try:
          from .version import version, cpp_sdk_version
      except ImportError as version_error:
          import_error = _version_load_error(version_error)
          version_imported = False
  
      if version_imported:
          # If the version loading succeeds, the most likely reason for a failure
          # is a mismatch between C++ and Python SDKs.
          import_error = _version_mismatch_error(
              error, version(), cpp_sdk_version())
  
      # Environment diagnostics currently only works for windows
      if platform.system().lower() == "windows":
          env_diagnostics = get_env_diagnostics()
  
          full_error_msg = """
  ---------------------------- ENVIRONMENT -----------------------------
  %s
  ----------------------------------------------------------------------
  %s
  """ % (env_diagnostics, import_error)
      else:
          full_error_msg = import_error
  
      # Also output the error message to a file if BLPAPI_DIAGNOSTICS is set
      diagnostics_path_env_var = "BLPAPI_DIAGNOSTICS"
      if diagnostics_path_env_var in os.environ:
          diagnostics_path = os.environ[diagnostics_path_env_var]
          try:
              with open(diagnostics_path, "w", encoding=getpreferredencoding()) as f:
                  f.write(full_error_msg)
          except IOError:
              print("Failed to write to path defined by %s: \"%s\"" \
                  % (diagnostics_path_env_var, diagnostics_path))
  
      return ImportError(full_error_msg)
function_tokens: def debug_load_error ( error ) : # Try to load just the version.py version_imported = True try : from . version import version , cpp_sdk_version except ImportError as version_error : import_error = _version_load_error ( version_error ) version_imported = False if version_imported : # If the version loading succeeds, the most likely reason for a failure # is a mismatch between C++ and Python SDKs. import_error = _version_mismatch_error ( error , version ( ) , cpp_sdk_version ( ) ) # Environment diagnostics currently only works for windows if platform . system ( ) . lower ( ) == "windows" : env_diagnostics = get_env_diagnostics ( ) full_error_msg = """
  ---------------------------- ENVIRONMENT -----------------------------
  %s
  ----------------------------------------------------------------------
  %s
  """ % ( env_diagnostics , import_error ) else : full_error_msg = import_error # Also output the error message to a file if BLPAPI_DIAGNOSTICS is set diagnostics_path_env_var = "BLPAPI_DIAGNOSTICS" if diagnostics_path_env_var in os . environ : diagnostics_path = os . environ [ diagnostics_path_env_var ] try : with open ( diagnostics_path , "w" , encoding = getpreferredencoding ( ) ) as f : f . write ( full_error_msg ) except IOError : print ( "Failed to write to path defined by %s: \"%s\"" % ( diagnostics_path_env_var , diagnostics_path ) ) return ImportError ( full_error_msg )