{"id":8274,"library":"libuuu","title":"libuuu Python Wrapper","description":"libuuu is a Python wrapper for the native NXP libuuu library, a universal update utility primarily used for flashing and interacting with NXP i.MX series embedded devices. It provides Python bindings to the C library's functionalities, allowing programmatic control over device flashing and communication. The library generally follows the versioning of the underlying C library, with releases occurring periodically to match new `libuuu` versions.","status":"active","version":"1.5.243","language":"en","source_language":"en","source_url":"https://github.com/nxp-imx/mfgtools/tree/master/wrapper","tags":["NXP","i.MX","flashing","embedded","firmware","ctypes","hardware"],"install":[{"cmd":"pip install libuuu","lang":"bash","label":"Install `libuuu` via pip"}],"dependencies":[{"reason":"This Python package is a wrapper; the underlying C/C++ `libuuu` shared library (libuuu.so on Linux, uuu.dll on Windows) must be installed on the system for it to function. It is not automatically installed by pip.","package":"libuuu (native library)","optional":false}],"imports":[{"symbol":"Uuu","correct":"from uuu import Uuu"},{"note":"The `cmd` function is a method of the `Uuu` class, not a direct module-level import.","wrong":"from uuu import cmd","symbol":"cmd","correct":"from uuu import Uuu; Uuu.cmd(...)"}],"quickstart":{"code":"from uuu import Uuu\nimport os\n\n# Optionally set the path to the native libuuu library if not in standard locations\n# os.environ['UUU_LIB_PATH'] = '/path/to/your/libuuu.so'\n\ntry:\n    # Initialize the Uuu wrapper\n    lib_uuu = Uuu()\n    \n    # Run a uuu command, e.g., get help\n    # Arguments must be passed as a list of strings\n    print(\"Running uuu -h...\")\n    return_code = lib_uuu.cmd(['-h'])\n    print(f\"Command exited with code: {return_code}\")\n\n    # Example of a command that might not apply without hardware\n    # print(\"Running uuu --version...\")\n    # return_code = lib_uuu.cmd(['--version'])\n    # print(f\"Command exited with code: {return_code}\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\n    print(\"Ensure the native libuuu shared library is installed and accessible.\")","lang":"python","description":"This quickstart demonstrates how to import the `Uuu` class and execute a simple command using its `cmd` method. It highlights the importance of passing command arguments as a list of strings and provides a common pattern for handling the underlying native library dependency."},"warnings":[{"fix":"Install the appropriate native `libuuu` library for your operating system. For NXP i.MX devices, this usually means installing the `mfgtools` package from NXP or compiling `uuu` from source. Ensure the library is in a standard system path or set the `UUU_LIB_PATH` environment variable to its location.","message":"The `libuuu` Python package is a wrapper. It requires the native `libuuu` shared library (e.g., `libuuu.so` on Linux, `uuu.dll` on Windows) to be installed on your system. This dependency is not handled by `pip` and must be resolved manually.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always provide command-line arguments as a list of strings, e.g., `lib_uuu.cmd(['-h'])` instead of `lib_uuu.cmd('-h')`.","message":"The `Uuu.cmd()` method expects its arguments as a list of strings, mimicking command-line arguments. Passing a single string will result in a `TypeError`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Ensure you have the necessary NXP i.MX hardware and firmware images if you intend to perform actual device flashing or interaction.","message":"The `libuuu` library is primarily designed for NXP i.MX series processors. While the Python wrapper can be installed anywhere, its practical utility is limited without access to compatible hardware or specific flashing images.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-16T00:00:00.000Z","next_check":"2026-07-15T00:00:00.000Z","problems":[{"fix":"Install the native `libuuu` library (e.g., `uuu` from NXP mfgtools) and ensure it's in a system-standard library path. Alternatively, set the environment variable `UUU_LIB_PATH` to the full path of the shared library file (e.g., `export UUU_LIB_PATH=/usr/local/lib/libuuu.so`).","cause":"The Python wrapper cannot find the native `libuuu` shared library on your system.","error":"FileNotFoundError: Could not find 'libuuu.so' or 'uuu.dll' in standard paths. Set UUU_LIB_PATH to specify its location."},{"fix":"Wrap your command-line arguments in a list. For example, change `lib_uuu.cmd('-h')` to `lib_uuu.cmd(['-h'])`.","cause":"You passed a single string to `Uuu.cmd()` instead of a list of strings.","error":"TypeError: 'str' object is not iterable"},{"fix":"Import the `Uuu` class and call `cmd` as a method on an instance of `Uuu`: `from uuu import Uuu; lib_uuu = Uuu(); lib_uuu.cmd(['-h'])`.","cause":"You tried to import `cmd` directly from the `uuu` module, but it's a method of the `Uuu` class.","error":"AttributeError: module 'uuu' has no attribute 'cmd'"}]}