Registry / data / odxtools

odxtools

JSON →
library11.1.0pypypi✓ verified 85d ago

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.

pip install odxtools
INSTALL
IMPORT
SIG · ODXTOOLS
O
odxtools
datapythonv11.1.0
Install
4.4s avg
Import
1116ms
Disk
41MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v11.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 1.164s · 42.4MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 4.4s · import 1.068s · 43MB
41MB installed
● package 41MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

odxtools
import odxtools

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.

import odxtools import os # This example requires an actual .pdx file. # For demonstration, we'll assume 'path/to/my_ecu.pdx' exists. # Replace 'path/to/my_ecu.pdx' with your ODX database file. # You can find example .pdx files in the odxtools GitHub repository. # Create a dummy .pdx file for demonstration purposes if it doesn't exist # In a real scenario, you would have your actual ODX/PDX file. pdx_file_path = 'my_ecu.pdx' if not os.path.exists(pdx_file_path): with open(pdx_file_path, 'w') as f: f.write("<ODXLINK><DATABASE><CONTAINER name='DummyECU'/></DATABASE></ODXLINK>") print(f"Created a dummy file: {pdx_file_path}") try: # Load an ODX database from a .pdx file db = odxtools.load_pdx_file(pdx_file_path) # List available ECUs (Electronic Control Units) print(f"Loaded database contains {len(db.ecus)} ECUs:") for ecu in db.ecus: print(f"- {ecu.short_name} (ID: {ecu.oid if hasattr(ecu, 'oid') else 'N/A'})") # Example: Accessing services of the first ECU (if any) if db.ecus: first_ecu = db.ecus[0] print(f"\nServices offered by {first_ecu.short_name}:") if hasattr(first_ecu, 'services') and first_ecu.services: for service in first_ecu.services: print(f"- {service.short_name}") else: print(" No services found for this ECU in the dummy file.") except Exception as e: print(f"An error occurred: {e}") finally: # Clean up the dummy file if os.path.exists(pdx_file_path): os.remove(pdx_file_path) print(f"Cleaned up dummy file: {pdx_file_path}")
odxtools --version
Debug
Known issues
breakingVersion 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.
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.
affects: >=11.0.0
gotchaThe 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.
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.
affects: All
gotchaAs 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.
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.
affects: All
Errors
Common errors & fixes
AttributeError: module 'odxtools' has no attribute 'load_odx_dbs'
Version 11.0.0 of `odxtools` introduced a significant refactoring, removing the older `load_odx_dbs` function in favor of more specific loading methods.
fix
Update your code to use the new loading functions like `odxtools.load_pdx_file()` for PDX files or `odxtools.load_odx_file()` for single ODX-D files, matching your ODX database type.
odxtools parsing error: ODX file not conformant
The ODX database file contains deviations from the ASAM ODX standard, or uses features not fully supported by `odxtools`, causing the library to halt processing in its default strict mode.
fix
Temporarily enable non-strict mode by setting `odxtools.exceptions.strict_mode = False` before loading the problematic file. Remember to reset `odxtools.exceptions.strict_mode = True` after parsing to maintain strict error checking for subsequent operations.
FileNotFoundError: [Errno 2] No such file or directory: 'path/to/your/file.pdx'
The Python interpreter cannot find the specified ODX or PDX file at the given path, either because the path is incorrect or the file does not exist in that location.
fix
Ensure the file path is correct, including the file name and extension. Use an absolute path or verify that the file is in the expected relative directory to your script. Always double-check typos in the file name or directory structure.
odxtools.exceptions.OdxError: Could not find object with short_name 'MY_DIAG_SERVICE_SHORT_NAME'
The specified short name or identifier for an ODX element (such as a diagnostic service, ECU, or data object property) does not exist within the loaded ODX database, or there is a mismatch in capitalization or spelling.
fix
Carefully inspect the ODX database content (e.g., by using the `odxtools browse` command-line tool or by iterating through the available objects in your script) to confirm the exact short name and hierarchical path of the desired element.
TypeError: a bytes-like object is required, not 'str'
An `odxtools` function that expects binary data (a `bytes` object) for encoding or decoding diagnostic messages received a string (`str`) instead, or vice-versa.
fix
Convert the data to the expected type: use `.encode('utf-8')` on a string to get bytes (e.g., `my_string.encode('utf-8')`), or `.decode('utf-8')` on bytes to get a string (e.g., `my_bytes.decode('utf-8')`), adjusting the encoding as necessary for your specific ODX messages.
Upgrade
Version history
11.1.0latest on PyPI · released May 11, 2026
Audit
Dependencies
bitstructrequiredBinary structure packing/unpacking.
argparse_addonsrequiredEnhancements for argument parsing.
jinja2requiredTemplating engine, likely for code generation or report generation.
python-canrequiredCAN bus communication support.
markdownifyrequiredMarkdown generation from HTML.
deprecationrequiredHandling of deprecated code.
packagingrequiredCore utilities for Python package metadata.
richrequiredRich text and beautiful formatting in the terminal, used for CLI tools.
typing_extensionsrequiredBackports of new typing features.
bincopyrequiredManipulation of binary files (e.g., Intel HEX, Motorola S-record).
InquirerPyoptionalInteractive prompts for the 'browse' CLI subcommand.
Agent activity
38 hits · last 30 days
node
36
OpenAI (training)
1
Resources
odxtools — pip install odxtools · libregistry