Skip to content
XulbuX edited this page Sep 15, 2025 · 4 revisions

System

This class includes methods that are really helpful when working with strings.


Class Properties

A class property can be accessed with Path.<property name>.

is_elevated is True if the current process has elevated privileges and False otherwise


restart()

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 and force is false
  • NotImplementedError if the current operating system is not supported

check_libs()

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)


elevate()

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⠀★

Project Links

Testing and Formatting

Classifiers

  • 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

The XulbuX Logo
Clone this wiki locally