Sam Hooke

Calling iPerf3 from Python

Creating the Client with iperf3-python §

If when calling this:

>>> import iperf3
>>> client = iperf3.Client()

You get this error:

Exception AttributeError: "'Client' object has no attribute '_stdout_fd'" in <bound method Client.__del__ of <iperf3.iperf3.Client object at 0x2505f90>> ignored
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/myapp/virtualenv/lib/python2.7/site-packages/iperf3/iperf3.py", line 414, in __init__
    super(Client, self).__init__(role='c', *args, **kwargs)
  File "/opt/myapp/virtualenv/lib/python2.7/site-packages/iperf3/iperf3.py", line 110, in __init__
    lib_name
OSError: Couldn't find shared library libiperf.so.0, is iperf3 installed?

Try explicitly setting lib_name to the location of your libiperf.so.0. For example:

>>> import iperf3
>>> client = iperf3.Client(lib_name='/usr/local/lib/libiperf.so.0')