What command are you running your script with?

On Tue, Jul 26, 2011 at 4:50 AM, Awdhesh Jha <[email protected]>wrote:

> I can't find the package com.android.monkeyrunner. Without it I can't
> work on the monkey device.
> The errors are comming when I run my program which name is monkey.py
>
>
> ===================================================================================
> *sys-package-mgr*: can't create package cache dir, '/usr/share/java/
> jython-2.2.1.jar/cachedir/packages'
> Traceback (innermost last):
>  File "/home/awdhesh/Programs/Python Programs/monkey.py", line 2,
> in ?
> ImportError: no module named android
>
> ===================================================================================
>
> ===================================================================================
> And the program is:
>
> # Imports the monkeyrunner modules used by this program
> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
> #from com.Simple.Calculator.SimpleCalculatorActivity import *
> device = MonkeyRunner()
> # Connects to the current device, returning a MonkeyDevice object
> device = MonkeyRunner.waitForConnection(30)
>
> # Installs the Android package. Notice that this method returns a
> boolean, so you can test
> # to see if the installation worked.
> device.installPackage('awdhesh/bin/android-sdk-linux_x86/tools/
> monkeyrunner.apk')
>
> # sets a variable with the package's internal name
> package = 'com.Simple.Calculator'
>
> # sets a variable with the name of an Activity in the package
> activity = 'com.Simple.Calculator.SimpleCalculatorActivity'
>
> # sets the name of the component to start
> runComponent = package + '/' + activity
>
> # Runs the component
> device.startActivity(component=runComponent)
>
> # Presses the Menu button
> device.press('KEYCODE_MENU','DOWN_AND_UP')
>
> # Takes a screenshot
> result = device.takeSnapshot()
>
> # Writes the screenshot to a file
> result.writeToFile('res/drawable/shot1.png','png')
>
> ===================================================================================
> Please send me the solution on my mail
> [email protected]
>
> Thanks in advance
>
> --
> You received this message because you are subscribed to the Google
> Groups "Android Developers" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]
> For more options, visit this group at
> http://groups.google.com/group/android-developers?hl=en
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to