Skip to content

Commit

Permalink
gattlib-py: Add support for loading 'libgattlib.so' from different lo…
Browse files Browse the repository at this point in the history
…cation
  • Loading branch information
oliviermartin committed Feb 26, 2024
1 parent f4cc321 commit d270205
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion gattlib-py/gattlib/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@

logger = logging.getLogger(__name__)

gattlib = cdll.LoadLibrary(str(pathlib.Path(__file__).with_name('libgattlib.so')))
try:
gattlib = cdll.LoadLibrary(str(pathlib.Path(__file__).with_name('libgattlib.so')))
except OSError:
# While in development, we might not have 'libgattlib.so' into the python directory
# We can define 'libgattlib.so' location using LD_LIBRARY_PATH
gattlib = CDLL('libgattlib.so')

def native_logging(level: int, string: str):
if level == 3:
Expand Down

0 comments on commit d270205

Please sign in to comment.