ImportError:没有使用Jython解释器命名为dtmilano的模块

时间:2014-11-18 10:23:21

标签: eclipse python-2.7 jython-2.7

我正在使用Eclipse Juno并使用Jython 2.7解释器创建PyDev项目,但我得到的Nulpointer异常如下所示

我的代码是

import re
import sys
import os


from com.android.monkeyrunner import MonkeyRunner

# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()

错误如下

 device = MonkeyRunner.waitForConnection()
    at com.android.monkeyrunner.MonkeyRunner.waitForConnection(MonkeyRunner.java:75)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
java.lang.NullPointerException: java.lang.NullPointerException

然后我添加了AndroidViewClient,但它抛出了ImportError。我为AndroidViewClient设置了p ath。

import re
import sys
import os

try:
    ANDROID_VIEW_CLIENT_HOME = os.environ['ANDROID_VIEW_CLIENT_HOME']
except KeyError:
    print >>sys.stderr, "%s: ERROR: ANDROID_VIEW_CLIENT_HOME not set in environment" % __file__
    sys.exit(1)
sys.path.append(ANDROID_VIEW_CLIENT_HOME + '/src')

from com.dtmilano.android.viewclient import ViewClient

from com.android.monkeyrunner import MonkeyRunner

# Connects to the current device, returning a MonkeyDevice object
device = MonkeyRunner.waitForConnection()

print "Success!"

有人可以帮我吗?欣赏这一点。

0 个答案:

没有答案