Skip to content

Commit

Permalink
Update python bindings errors when looking for lib
Browse files Browse the repository at this point in the history
Make error helpful when python cannot find the libiio C library

Signed-off-by: Travis F. Collins <[email protected]>
  • Loading branch information
tfcollins committed Oct 1, 2024
1 parent 4aeb927 commit cdf315e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions bindings/python/iio/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,12 @@ class ChannelType(Enum):
_iiolib = "libiio.dll"
else:
# Non-windows, possibly Posix system
_iiolib = "iio"
_iiolib = "libiio.so.1"

_lib = _cdll("libiio.so.1", use_errno=True, use_last_error=True)
_lib_loc = find_library(_iiolib)
if _lib_loc is None:
raise OSError(2, "Could not find libiio C library")
_lib = _cdll(_lib_loc, use_errno=True, use_last_error=True)
_libc = _cdll(find_library("c"))

_get_backends_count = _lib.iio_get_builtin_backends_count
Expand Down

0 comments on commit cdf315e

Please sign in to comment.