Skip to content

Conversation

@gardiens
Copy link

@gardiens gardiens commented Dec 3, 2025

Hello,

When iio is loaded and a failure occurs in Python, the only feedback currently produced is a long, opaque string, and the script aborts with a generic "NULL pointer access" error. This message provides little diagnostic value.

To improve error reporting, I modified the read interface so that the last IIO error is retrieved and surfaced as a standard Python ValueError containing the original error message.

Example:


img = iio.read(path)

File ~/.local/lib/python3.8/site-packages/iio.py:72, in read(filename)
     err = __iio_get_last_error()
     if err:
         raise ValueError(err.decode("utf-8"))
     raise ValueError("iio_read returned NULL without error message")

Resulting in:

ValueError: compressed scanlines not implemented yet
This provides a clearer and more informative error message for users.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant