The problem, which is also in Google documentation, is the missing
pair of parenthesis
18 result = device.takeSnapshot()
^^
otherwise, you are getting a reference to the method.
On Jan 30, 6:58 am, dan raaka <[email protected]> wrote:
> I am running this as ./monkeyrunner test.py
>
> 17 # Takes a screenshot
> 18 result = device.takeSnapshot
> 19
> 20 # Writes the screenshot to a file
> 21 result.writeToFile('shot1.png','png')
>
> This throws an error as.. any thoughts ...
>
> mini@tools$./monkeyrunner test.py
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]
> Script terminated due to an exception
> 110130 03:47:34.316:S [main]
> [com.android.monkeyrunner.MonkeyRunnerOptions]Traceback (most recent call
> last):
> File "/Users/dan/Android/android-sdk-mac_x86/tools/test.py", line 21, in
> <module>
> result.writeToFile('shot1.png','png')
> AttributeError: 'instancemethod' object has no attribute 'writeToFile'
>
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyException.fillInStackTrace(PyException.java:70)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> java.lang.Throwable.<init>(Throwable.java:181)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> java.lang.Exception.<init>(Exception.java:29)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> java.lang.RuntimeException.<init>(RuntimeException.java:32)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyException.<init>(PyException.java:46)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyException.<init>(PyException.java:43)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyException.<init>(PyException.java:61)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.Py.AttributeError(Py.java:145)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyObject.noAttributeError(PyObject.java:936)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyObject.__getattr__(PyObject.java:931)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.pycode._pyx0.f$0(/Users/dan/Android/android-sdk-mac_x86/tools/te
> st.py:21)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.pycode._pyx0.call_function(/Users/dan/Android/android-sdk-mac_x8
> 6/tools/test.py)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyTableCode.call(PyTableCode.java:165)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.PyCode.call(PyCode.java:18)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.Py.runCode(Py.java:1197)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.core.__builtin__.execfile_flags(__builtin__.java:538)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:156)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:9 2)
> 110130 03:47:34.316:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at
> com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:
> 203)
> mini@tools$
>
> -Dan
--
Have you read my blog ?
http://dtmilano.blogspot.com
android junit tests ui linux cult thin clients
--
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