I'm writing a simple test for Android app and it fails while trying to connect my device with this log:
Traceback (most recent call last): File "D:/MonkeyRunnerTest/test/LaunchTest.py", line 3, in <module> from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice ImportError: No module named 'com'
I use Pycharm 2.7.3, Python 3.3.2, juthon-standalone-2.5.3. I've tried to launch my test project on Eclipse with PyDev and Intellij Idea with Python plug-in, but with the same result. Also I've added environment variable PYTHONPATH containing the path to monkeyrunner and jython source to my operation system (Windows 7), it didn't help.
Any suggestions for this issue?
You should only use monkeyrunner
interpreter to run monkeyrunner scripts. Forget about python, jython, etc.
From you command line try:
monkeyrunner LaunchTest.py
and it will work.
You can find some instructions to use monkeyrunner with Eclipse+Pydev. See the updates at the bottom of the page.
Assuming you have the proper modules installed: They aren't in your system path. You can check your system path manually to see if the directory is there by doing
import sys
print sys.path
You can append to sys.path
as you would any list, but it's probably better to modify it via your OS, rather than on the fly appending. (which is temporary, sys.path
reverts to its original state after the end of the script in python)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With