#πŸ”’ ctypes.CDLL() wont find my library

8 messages Β· Page 1 of 1 (latest)

orchid yarrow
#

Im pretty confused right now since ctypes.CDLL() wont even find my library even though i have specified the absolute path to the library. Instead i get an error that says this:

Traceback (most recent call last):
  File "/home/adde/test_buffer.py", line 10, in <module>
    print(ctypes.CDLL(os.path.join(basepath, 'dlls', 'libmodsecurity.so.3.0.6')))
  File "/usr/lib/python3.10/ctypes/__init__.py", line 374, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: libGeoIP.so.1: cannot open shared object file: No such file or directory

My python code is this:

from ctypes.util import find_library
import ctypes

import os
basepath = os.path.dirname(os.path.abspath(__file__))
dllpath = os.path.join(basepath, 'dlls', 'libmodsecurity.so')
print(ctypes.CDLL(os.path.join(basepath, 'dlls', 'libmodsecurity.so.3.0.6')))
bronze parrotBOT
#

@orchid yarrow

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

orchid yarrow
#

This is

#

the absolute .so file path

#

/home/adde/dlls/libmodsecurity.so.3.0.6

#

I just dont understand why the module replaces my library with another library that i did not specify at all

bronze parrotBOT
#

@orchid yarrow

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.