测试时想用 ViewClient,于是下了 jar 包,解压,添加环境变量,只写了一个导入语句的 py 文件,
from com.dtmilano.android import viewclient
在 Python 环境下直接运行 from com.dtmilano.android import viewclient,没有错误
C:\Users\Administrator>python
Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win
32
Type "help", "copyright", "credits" or "license" for more information.

from com.dtmilano.android import viewclient

但是用 monkeyrunner 运行 py 文件,会出错
C:\Users\Administrator>monkeyrunner D:\work\workspace\aaa\test.py
140120 17:04:28.586:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Scri
pt terminated due to an exception
140120 17:04:28.586:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Trace
back (most recent call last):
File "D:\work\workspace\aaa\test.py", line 27, in
from com.dtmilano.android import viewclient
ImportError: No module named dtmilano

问什么呢?导包的话该怎么写呢?菜鸟求指教。谢谢。


↙↙↙阅读原文可查看相关链接,并与作者交流