【问题标题】:Not able to setup AndroidViewClient on Windows 7无法在 Windows 7 上设置 AndroidViewClient
【发布时间】:2014-11-04 03:23:00
【问题描述】:

我参考了wiki 并通过互联网进行了尝试,但无法使其正常工作。 我已将 ANDROID_VIEW_CLIENT_HOME 设置为 AndroidViewClient 文件夹,将 PYTHONPATH 设置为 AndroidViewClient/src 文件夹。

我仍然无法导入 ViewClient 并在运行 monkeyrunner 脚本时出现以下异常。

    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)

你能不能告诉我我错过了什么?

【问题讨论】:

  • 哪个 AndroidViewClient 版本?请注意,最新版本不使用 jython 或 monkeyrunner。
  • 我正在使用 AndroidViewClient-5.1.1。我关注了你的 wiki (github.com/dtmilano/AndroidViewClient/…) 但得到了例外。

标签: android androidviewclient


【解决方案1】:

强烈推荐使用easy_install来安装AndroidViewClient。但是,可能不清楚如何在 Windows 上执行此操作,在这种情况下,您可能会发现 How to use Python's "easy_install" on Windows ... it's not so easy 的答案很有帮助。

【讨论】:

  • 谢谢。我在 Python IDE 中打开了 AndroidViewClient 项目,并将我的测试脚本复制到了示例文件夹中。我能够在我的设备上运行测试。我将尝试使用 easy_install 安装 AndroidViewClient,看看它是否可以帮助我从任何地方运行我的脚本。
  • 太棒了。这应该是指定正确的 PYTHONPATH 的问题,请参阅stackoverflow.com/questions/3701646/…
  • 你是对的。我让它工作并且能够从任何地方运行脚本。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-10-26
  • 2015-04-22
  • 2011-09-02
  • 1970-01-01
  • 2014-12-21
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多