thiezn / iperf3-python

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

Any support planned for windows? #30

Open beachwood23 opened 6 years ago

beachwood23 commented 6 years ago

Is there support for windows planned? Perhaps this is something I could assist with.

Attempting run this python wrapper on windows (with iperf3 installed through chocolatey) results in a missing library. See the below error.

Python 3.6.4 (v3.6.4:d48eceb, Dec 19 2017, 06:54:40) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import iperf3
>>> client = iperf3.Client()
Traceback (most recent call last):
  File "C:\Python36\lib\site-packages\iperf3\iperf3.py", line 102, in __init__
    self.lib = cdll.LoadLibrary(lib_name)
  File "C:\Python36\lib\ctypes\__init__.py", line 426, in LoadLibrary
    return self._dlltype(name)
  File "C:\Python36\lib\ctypes\__init__.py", line 348, in __init__
    self._handle = _dlopen(self._name, mode)
OSError: [WinError 126] The specified module could not be found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python36\lib\site-packages\iperf3\iperf3.py", line 410, in __init__
    super(Client, self).__init__(role='c', *args, **kwargs)
  File "C:\Python36\lib\site-packages\iperf3\iperf3.py", line 106, in __init__
    lib_name
OSError: Couldn't find shared library libiperf.so.0, is iperf3 installed?
thiezn commented 6 years ago

Hi @rywhite, the release 0.1.10 just submitted to PyPi should allow you to manually set the iperf3 library client = iperf3.Client(lib_name='nameandpathtoiperf')

Let me know if this helps.

chenyu82 commented 5 years ago

Looks doesn't work. any thing wrong?

client = iperf3.Client(lib_name="D:\SW_Tool\iperf3\iperf3.exe") Exception AttributeError: "'Client' object has no attribute '_stdout_fd'" in <bo und method Client.del of <iperf3.iperf3.Client object at 0x000000000259D390> ignored Traceback (most recent call last): File "", line 1, in File "C:\Python27\lib\site-packages\iperf3\iperf3.py", line 414, in init super(Client, self).init(role='c', *args, **kwargs) File "C:\Python27\lib\site-packages\iperf3\iperf3.py", line 110, in init lib_name OSError: Couldn't find shared library D:\SW_Tool\iperf3\iperf3.exe, is iperf3 in stalled?

fanfajrin commented 5 years ago

Hey @rywhite i have same issues with you, and i windows user too.

@thiezn I did what you said but got same error

thiezn commented 5 years ago

Hi @rywhite @fanfajrin

I see you tried to provide a link to the iperf3.exe as lib_name but this is not the actual library interface. Check the following link for a proper explanation of why the iperf3-python wrapper does not work for windows at the moment: https://github.com/esnet/iperf/issues/514

@virtualtam has created a new repository using Cython to try and get around the issue on windows, perhaps this can help: https://github.com/virtualtam/iperf3-cython-wrapper.