{"id":6016,"library":"odxtools","title":"ODX Tools","description":"odxtools is a Python library providing utilities to work with the ODX (Open Diagnostic Data eXchange) standard, primarily for automotive diagnostics. It enables parsing and internalizing ODX diagnostic database files, as well as encoding and decoding diagnostic messages for Electronic Control Units (ECUs). The library is actively maintained with frequent minor releases and occasional major version updates; the current version is 11.0.6.","status":"active","version":"11.0.6","language":"en","source_language":"en","source_url":"https://github.com/mercedes-benz/odxtools","tags":["automotive","diagnostics","ODX","ECU","UDS","CAN"],"install":[{"cmd":"pip install odxtools","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Binary structure packing/unpacking.","package":"bitstruct","optional":false},{"reason":"Enhancements for argument parsing.","package":"argparse_addons","optional":false},{"reason":"Templating engine, likely for code generation or report generation.","package":"jinja2","optional":false},{"reason":"CAN bus communication support.","package":"python-can","optional":false},{"reason":"Markdown generation from HTML.","package":"markdownify","optional":false},{"reason":"Handling of deprecated code.","package":"deprecation","optional":false},{"reason":"Core utilities for Python package metadata.","package":"packaging","optional":false},{"reason":"Rich text and beautiful formatting in the terminal, used for CLI tools.","package":"rich","optional":false},{"reason":"Backports of new typing features.","package":"typing_extensions","optional":false},{"reason":"Manipulation of binary files (e.g., Intel HEX, Motorola S-record).","package":"bincopy","optional":false},{"reason":"Interactive prompts for the 'browse' CLI subcommand.","package":"InquirerPy","optional":true}],"imports":[{"symbol":"odxtools","correct":"import odxtools"}],"quickstart":{"code":"import odxtools\nimport os\n\n# This example requires an actual .pdx file. \n# For demonstration, we'll assume 'path/to/my_ecu.pdx' exists.\n# Replace 'path/to/my_ecu.pdx' with your ODX database file.\n# You can find example .pdx files in the odxtools GitHub repository.\n\n# Create a dummy .pdx file for demonstration purposes if it doesn't exist\n# In a real scenario, you would have your actual ODX/PDX file.\npdx_file_path = 'my_ecu.pdx'\nif not os.path.exists(pdx_file_path):\n    with open(pdx_file_path, 'w') as f:\n        f.write(\"<ODXLINK><DATABASE><CONTAINER name='DummyECU'/></DATABASE></ODXLINK>\")\n    print(f\"Created a dummy file: {pdx_file_path}\")\n\ntry:\n    # Load an ODX database from a .pdx file\n    db = odxtools.load_pdx_file(pdx_file_path)\n\n    # List available ECUs (Electronic Control Units)\n    print(f\"Loaded database contains {len(db.ecus)} ECUs:\")\n    for ecu in db.ecus:\n        print(f\"- {ecu.short_name} (ID: {ecu.oid if hasattr(ecu, 'oid') else 'N/A'})\")\n\n    # Example: Accessing services of the first ECU (if any)\n    if db.ecus:\n        first_ecu = db.ecus[0]\n        print(f\"\\nServices offered by {first_ecu.short_name}:\")\n        if hasattr(first_ecu, 'services') and first_ecu.services:\n            for service in first_ecu.services:\n                print(f\"- {service.short_name}\")\n        else:\n            print(\"  No services found for this ECU in the dummy file.\")\n\nexcept Exception as e:\n    print(f\"An error occurred: {e}\")\nfinally:\n    # Clean up the dummy file\n    if os.path.exists(pdx_file_path):\n        os.remove(pdx_file_path)\n        print(f\"Cleaned up dummy file: {pdx_file_path}\")\n","lang":"python","description":"This quickstart demonstrates how to load an ODX database from a .pdx file and iterate through the available ECUs and their services. It includes a placeholder for a PDX file, which you would replace with your actual diagnostic database."},"warnings":[{"fix":"Update your code to use the new, more specific loading functions such as `odxtools.load_pdx_file()` for PDX files, or `odxtools.load_odx_file()` for single ODX-D files. Refer to the latest documentation or examples on the GitHub README for the correct function to use for your file type.","message":"Version 11.0.0 introduced a significant refactoring and renaming of the database loading methods. Older functions like `odxtools.load_odx_dbs` are no longer available.","severity":"breaking","affected_versions":">=11.0.0"},{"fix":"Use the non-strict mode (`odxtools.exceptions.strict_mode = False`) sparingly and with caution. Always re-enable strict mode (`odxtools.exceptions.strict_mode = True`) immediately after parsing the non-conformant file to prevent unexpected behavior in subsequent operations. Ensure thorough validation of data processed in non-strict mode.","message":"The library provides a 'non-strict' mode to handle ODX files that are not fully conformant with the specification or contain unsupported features. While useful for parsing problematic files, enabling this mode can lead to undefined behavior or incomplete results as issues are ignored.","severity":"gotcha","affected_versions":"All"},{"fix":"A solid understanding of ODX concepts is highly recommended before diving into the library. Leverage the examples provided in the GitHub repository and be prepared to explore the source code for deeper insights. Engage with the project's GitHub issues for community support.","message":"As a specialized library for the ODX standard, `odxtools` can have a steep learning curve due to the complexity of ODX itself and the niche nature of the domain. Public documentation beyond the GitHub README might be limited, requiring users to rely heavily on the provided examples and source code.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-14T00:00:00.000Z","next_check":"2026-07-13T00:00:00.000Z"}