thiezn / iperf3-python

Python wrapper around iperf3
https://iperf3-python.readthedocs.org/
MIT License
111 stars 51 forks source link

Please add the ability to override the library name as find_library is broken! #31

Closed seitzbg closed 6 years ago

seitzbg commented 6 years ago

utils.find_library does not work on Python 2.7.14 in my testing:


$ ./find.py
Finding path for library [libiperf] = None

$ cat find.py
#!/usr/bin/python
from ctypes import util

lib = "libiperf"

print "Finding path for library [{}] = {}".format(lib, util.find_library(lib))

$ /usr/bin/python --version
Python 2.7.14

$ ldconfig -p |grep libiperf
        libiperf.so.0 (libc6,x86-64) => /lib64/libiperf.so.0
        libiperf.so (libc6,x86-64) => /lib64/libiperf.so

And actually this seems to work:

% ./find.py
Finding path for library [iperf] = libiperf.so.0

So we need to be able to specify the library name it looks for at the very least, and override the lib_name itself would also be ideal.

Also it does seem that it gets set to libiperf.so.0 via the None check, however it fails to load the library still?

OSError: Couldn't find shared library libiperf.so.0, is iperf3 installed?
Exception AttributeError: "'Client' object has no attribute '_stdout_fd'" in <bound method Client.__del__ of <iperf3.iperf3.Client object at 0x7f5152cc8850>> ignored

Or is my library too old?
seitzbg commented 6 years ago

Closing for now, I think this is my issue due to using Bazel build.

thiezn commented 6 years ago

@seitzbg could be a handy feature anyway for people, even if its for troubleshooting purposes. The latest version 0.1.10 submitted to PyPi allows you to set the library name by doing:

client = iperf3.Client(lib_name='mypathandlibname')

seitzbg commented 6 years ago

Thanks!