Reputation: 79
I am having problems with my python script. I am trying to automate a process using python on windows machine. I open an adb shell and run iperf using it. os.system
initiates an cmd window and I can see the output. This code works as it should but there is a problem. Sometimes the windows closes arbitrarily. There is no specific time for it they run for a while and then they got close randomly (as it looks).
When I use the actual mobile iperf app for this task even there is problem with the network the app keep working thus I can run the iperf for days. However with the script, even though I use the same arguments the windows got close after sometime.
I tried adding && pause
, >output.txt
, && echo a
at the end of the command however none of them worked. How can solve this problem? I want it to run until I close the windows manually just like it does on the mobile app.
directory = 'correct_directory'
buildCommand = 'adb'
if Protocol: #TCP
if link: #UL
buildArgs = f'-s {serial_no} shell \"cd data/local/tmp && ./iperf2.1.4 -i2 -c{IP_address} -p{port} -t{str(time_)} \"'
os.system('cd {} && start "" "{}" {}'.format(directory, buildCommand, buildArgs))
else: #DL
buildArgs = f'-s {serial_no} shell \"cd data/local/tmp && ./iperf2.1.4 -s -i2 -p{port} -P 1 \"'
os.system('cd {} && start "" "{}" {}'.format(directory, buildCommand, buildArgs))
Upvotes: 1
Views: 44