rpyutils package

Submodules

Module contents

rpyutils.add_dll_directories_from_env(env_name: str)

Add a list of directories from an environment variable to the DLL search path on Windows.

Each directory in the environment variable that exists is passed to os.add_dll_directory().

If this function is called on a system other than Windows, then nothing happens and an empty list is returned. If this function is called with a version of Python less than 3.8, then nothing happens and an empty list is returned.

Example usage:

with add_dll_directories_from_env('PATH'):
    importlib.import_module('foo', package='bar')
Parameters:

env_name – The name of the environment variable with DLL search paths.

Returns:

A list of handles to directories.

rpyutils.import_c_library(name: str, package: str | None = None)

Import and return a C extension library using importlib, with consistent error messaging.

See importlib.import_module documentation for details on the parameters and return type.

:param name :param package :return The loaded module :raises ImportError