ImportError: No module named dtmilano using Jython interpreter

182 views Asked by At

I am using Eclipse Juno and created PyDev project using Jython 2.7 interpreter but I am getting Nulpointer Exception as below

my code is

import re
import sys
import os


from com.android.monkeyrunner import MonkeyRunner

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

error is as below

 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

and then I added AndroidViewClient, but its throwing ImportError. I have set theP ath for AndroidViewClient.

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!"

Can someone please help me here? appreciate that.

0

There are 0 answers