My favorites | Sign in
Project Home Issues
New issue   Search
for
  Advanced search   Search tips   Subscriptions
Issue 55632: On SDK 22 monkeyrunner scripts fail to import python modules/classes
2 people starred this issue and may be notified of changes. Back to list
Status:  Released
Owner:  vs...@google.com
Closed:  May 2013


Sign in to add a comment
 
Reported by elenax.m...@intel.com, May 21, 2013
====================Test Environment================ 
- Android SDK Tools 22
- Android SDK Platform-tools 17
- Android SDK Build-tools 17

   
====================Scenario====================== 
- Step 1 – Create a monkeyrunner script (test.py) with the following imports
import os
import sys
from os import path, access, R_OK
from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice, MonkeyImage
- Step 2 – Run the script using monkeyrunner 


====================Expected Results================ 
- Script should run without errors (on SDK 21.1 there were no issues)

====================Actual Results================== 
- The jython.jar from tools/lib was changed with jython-2.5.3.jar which doesn't have the LIB folder.The following error is received 
130523 14:54:35.401:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Scri
pt terminated due to an exception
130523 14:54:35.401:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]Trace
back (most recent call last):
  File "G:\SDK_auto\test.py", line 1, in <module>
    import os
ImportError: No module named os
May 21, 2013
Project Member #1 vs...@google.com
(No comment was entered for this change.)
Owner: vs...@google.com
May 21, 2013
Project Member #2 vs...@google.com
https://android.googlesource.com/platform/tools/swt/+/master/monkeyrunner/build.gradle lists the dependency as org.python:jython:2.5.3. I believe it should be: org.python:jython-standalone:2.5.3

http://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.python%22%20AND%20v%3A%222.5.3%22
Owner: r...@android.com
May 21, 2013
#3 sergey.n...@gmail.com
Is there any workaround for this issue? 
May 21, 2013
#4 sergey.n...@gmail.com
I am not sure how clean is my solution.
1. Download jython standalone version http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22org.python%22%20AND%20a%3A%22jython-standalone%22
2. copy and paste it to android-sdk/tools/lib instead of existent jython there.
3. Run monkey runner
4. when trying to run 'import os' no error occurs.
May 22, 2013
Project Member #5 vs...@google.com
Yes, 22.0.1 uses jython-standalone instead of jython:

https://android-review.googlesource.com/#/c/59173/1/monkeyrunner/build.gradle
Status: FutureRelease
Owner: vs...@google.com
May 28, 2013
Project Member #6 vs...@google.com
(No comment was entered for this change.)
Status: Released
Sign in to add a comment

Powered by Google Project Hosting