0

I referred to the wiki and tried over the internet but could not make it working. I have set ANDROID_VIEW_CLIENT_HOME to AndroidViewClient folder, PYTHONPATH to AndroidViewClient/src folder.

I am still not able to import the ViewClient and getting following exception on running the monkeyrunner script.

    from com.dtmilano.android.viewclient import ViewClient
ImportError: No module named dtmilano

140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.ImportError(Py.java:304)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.import_logic(imp.java:790)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.import_module_level(imp.java:842)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.importName(imp.java:917)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.ImportFunction.__call__(__builtin__.java:1220)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyObject.__call__(PyObject.java:357)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.__builtin__.__import__(__builtin__.java:1173)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.importFromAs(imp.java:1011)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.imp.importFrom(imp.java:987)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.f$0(c:\testing\demo.py:40)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.pycode._pyx0.call_function(c:\testing\demo.py)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyTableCode.call(PyTableCode.java:165)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.PyCode.call(PyCode.java:18)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.runCode(Py.java:1275)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.__builtin__.execfile_flags(__builtin__.java:522)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)
140910 18:18:23.594:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)

Can you anbybody suggest what am I missing?

user846316
  • 6,037
  • 6
  • 31
  • 40
  • Which *AndroidViewClient* version? Note that latest versions don't use jython or monkeyrunner. – Diego Torres Milano Sep 10 '14 at 15:08
  • I am using AndroidViewClient-5.1.1. I followed your wiki (https://github.com/dtmilano/AndroidViewClient/wiki#verifying-environment-setup) but getting the exception. – user846316 Sep 10 '14 at 15:44

1 Answers1

0

It is highly recommended to use easy_install to install AndroidViewClient. However, it may not be clear how to do it on Windows, in such case you may find helpful the answers to How to use Python's "easy_install" on Windows ... it's not so easy.

Community
  • 1
  • 1
Diego Torres Milano
  • 65,697
  • 9
  • 111
  • 134
  • Thanks. I opened the AndroidViewClient project in Python IDE and copied my test script in the examples folder. I am able to run the tests on my device. I'll try installing AndroidViewClient using easy_install and see if it can help me in running my scripts from anywhere. – user846316 Sep 11 '14 at 03:55
  • 1
    Great. It should be a matter of specifying the correct PYTHONPATH, see http://stackoverflow.com/questions/3701646/how-to-add-to-the-pythonpath-in-windows-7 – Diego Torres Milano Sep 11 '14 at 13:59
  • You're right. I got it working and able to run the script from anywhere. – user846316 Sep 11 '14 at 14:18