Mismatched input "waiting for RPAREN: when running jython script

I am trying to run a jython script that installs a package and opens an action, then takes its screenshot and finally saves it to a file. For this, I use the following code:

from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice device = MonkeyRunner.waitForConnection() device.installPackage('F:\jind\Example.apk') package= 'com.android.example' activity= 'com.android.example.main_activity' runComponent= package + '/' + activity device.startActivity(component=runComponent) device.press('KEYCODE_MENU', MonkeyDevice.DOWN_AND_UP) result=device.takeSnapshot() result.writeToFile('F:\jind\lk.png','png') 

After running the script. writeToFile () gives an error saying "result of inappropriate input" waiting for RPAREN

Thanks at Advance

+4
source share
2 answers

The RPAREN error is related to a parameter error in result.writeToFile('F:\jind\lk.png','png') . His escape character. use result.writeToFile('F:\\jind\\lk.png','png') to avoid the "\". Hope this works.

+2
source

fix missing ')':

 device.press() 
+1
source

All Articles