-
-
Notifications
You must be signed in to change notification settings - Fork 0
system
This class includes methods that are really helpful when working with strings.
A class property can be accessed with Path.<property name>
.
is_elevated
is True
if the current process has elevated privileges and False
otherwise
This method restarts the system with some advanced options.
Params:
-
prompt: object = ""
the message to be displayed in the systems restart notification -
wait: int = 0
the time to wait until restarting in seconds -
continue_program: bool = False
whether to continue the current Python program after calling this function -
force: bool = False
whether to force a restart even if other processes are still running
Returns: no return value
Raises:
-
RuntimeError
if processes are still running andforce
is false -
NotImplementedError
if the current operating system is not supported
This method checks if all libraries in a given list are installed and optionally installs the missing ones.
Params:
-
lib_names: list[str]
a list of library names to check -
install_missing: bool = False
whether to directly missing libraries will be installed automatically using pip -
missing_libs_msgs: tuple[str, str] = ("The following required libraries are missing:", "Do you want to install them now?")
two messages: the first one is displayed when missing libraries are found, the second one is the confirmation message before installing missing libraries -
confirm_install: bool = True
whether the user will be asked for confirmation before installing missing libraries
Returns: a list of missing libraries or None
if all libraries are installed (or were installed successfully)
This method restarts the current Python script with elevated privileges and the option to pass arguments to the new process.
Params:
-
win_title: Optional[str] = None
the title of the window of the new process -
args: list[str] = []
a list of arguments to pass to the new process
Returns: True
if the process was successfully restarted with elevated privileges and False
otherwise
Raises: PermissionError
if the user refused to grant elevated privileges or the elevation failed for some other reason
★⠀Python Library by XulbuX⠀★
-
Intended Audience:
- Developers
-
License:
- OSI Approved
- MIT License
-
Operating Systems:
- Full Library: OS Independent
-
Supported Python Versions:
- Python 3.13
- Python 3.12
- Python 3.11
- Python 3.10
-
Topics:
- Libraries
- Python Modules
- Software Development