thiezn / iperf3-python

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

I can't take several measures #37

Open Castaneira7 opened 5 years ago

Castaneira7 commented 5 years ago

I would like to repeat the tests several times to relieve the bandwidth of an entire room. but when I repeat the test it gives me an error that I suppose is to rewrite the variable result = client.run ()

Traceback (most recent call last): File "/home/pi/Desktop/test1.py", line 19, in test = client.run() File "/usr/local/lib/python3.5/dist-packages/iperf3-0.1.10-py3.5.egg/iperf3/iperf3.py", line 612, in run output_to_screen(self._stdout_fd, self._stderr_fd) # enable stdout File "/usr/local/lib/python3.5/dist-packages/iperf3-0.1.10-py3.5.egg/iperf3/iperf3.py", line 80, in output_to_screen os.dup2(stdoutfd, 1) OSError: [Errno 9] Bad file descriptor**

any help??

iamjarvs commented 5 years ago

I hit this toady 'OSError: [Errno 9] Bad file descriptor' trying to run two tests in a singe function. My work around was.

def iperfSingleTest():
  <test setup> 
  result = client.run ()
  print(result)

def iperfManyTests():
  for i in range(1,3):
    iperfSingleTest()

Hope this helps

ckleu commented 5 years ago

I got a workaround here:

print("starting test")
for i in range(ITERATIONS):
  test = new_client_configure()
  r = test.run()
  print("{}".format(r.received_Mbps))
  del test
  time.sleep(2)

Delete the testing object to initiate the __del__function to close the sockets.