1

I am facing some issues in device.shell('ping -c 2 192.168.1.1') inside a monkeyrunner script. Its throwing

ShellCommandUnrespo‌​nsiveException 
[main] [com.android.chimpchat.adb.AdbChimpDevice]com.android.ddmlib.ShellCommandUnrespo‌​nsiveException 
while (count<1000) :
device.shell('dmesg -c')
print '****swithing OFF wifi in loop NO-',count
device.touch(400,155,MonkeyDevice.DOWN_AND_UP)
time.sleep(10)
print '****switching ON wifi in loop NO-',count
device.touch(400,155,MonkeyDevice.DOWN_AND_UP)
time.sleep(25)
fd=open('pingstats.txt','a+b')
fd.write('***Loop-%i \n************\n%s\n****************\n' % (int(count),ping))
ping = device.shell('ping -c 2 192.168.1.1')
status=re.search('unreachable',ping)
if status:
    dmesg=device.shell('dmesg')
    fd.write(logcat)
fd.close()
count = count + 1

Please see above script. How can I fix this?

Mat
  • 202,337
  • 40
  • 393
  • 406
Rilwan
  • 2,251
  • 2
  • 19
  • 28

2 Answers2

0

Just add -t . An example below works perfectly !

device.shell('pm enable packageName -t 15')
Mohamed Amine
  • 2,264
  • 1
  • 23
  • 36
Arush
  • 13
  • 5
0

your ping waits to long

add a -t

start with -t 1

Blauohr
  • 5,985
  • 2
  • 25
  • 31