parameters: (lib_path)
return_statement: return lib
docstring: Load DLR library.
docstring_summary: Load DLR library.
docstring_tokens: Load DLR library .
function: def _load_lib(lib_path):
      """Load DLR library."""
      try:
          pathBackup = os.environ['PATH'].split(os.pathsep)
      except KeyError:
          pathBackup = []
      
      try:
          # needed when the lib is linked with non-system-available dependencies
          os.environ['PATH'] = os.pathsep.join(pathBackup + [os.path.dirname(lib_path)])
          lib = ctypes.cdll.LoadLibrary(lib_path)
      except Exception as e:
          libname = os.path.basename(lib_path)
          raise DLRError(
              'DLR library ({}) could not be loaded.\n'.format(libname) +
              'Likely causes:\n' +
              '  * OpenMP runtime is not installed ' +
              '(vcomp140.dll or libgomp-1.dll for Windows, ' +
              'libgomp.so for UNIX-like OSes)\n' +
              '  * You are running 32-bit Python on a 64-bit OS\n' +
              'Error message(s): {}\n'.format(e))
      finally:
          os.environ['PATH'] = os.pathsep.join(pathBackup)
      
      lib.DLRGetLastError.restype = ctypes.c_char_p
      return lib
function_tokens: def _load_lib ( lib_path ) : try : pathBackup = os . environ [ 'PATH' ] . split ( os . pathsep ) except KeyError : pathBackup = [ ] try : # needed when the lib is linked with non-system-available dependencies os . environ [ 'PATH' ] = os . pathsep . join ( pathBackup + [ os . path . dirname ( lib_path ) ] ) lib = ctypes . cdll . LoadLibrary ( lib_path ) except Exception as e : libname = os . path . basename ( lib_path ) raise DLRError ( 'DLR library ({}) could not be loaded.\n' . format ( libname ) + 'Likely causes:\n' + '  * OpenMP runtime is not installed ' + '(vcomp140.dll or libgomp-1.dll for Windows, ' + 'libgomp.so for UNIX-like OSes)\n' + '  * You are running 32-bit Python on a 64-bit OS\n' + 'Error message(s): {}\n' . format ( e ) ) finally : os . environ [ 'PATH' ] = os . pathsep . join ( pathBackup ) lib . DLRGetLastError . restype = ctypes . c_char_p return lib