Wednesday, August 29, 2012

monkeyrunner: setting Eclipse PyDev interpreter

There have been some popular posts in this blog describing the use of Eclipse, PyDev and monkeyrunner. However, I have received a lot of questions regarding the definition of the interpreter and perhaps it requires a little deep explanation.

Even though monkeyrunner is a Jython interpreter, to successfully use it from PyDev you have to identify it as plain Python.

This screenshot shows the definition of the interpreter which coincidentally, we called monkeyrunner.

Following these steps you would have no problems using monkeyrunner from PyDev.
Hope this helps.


Ashwani Kumar said...

I am trying to do this on Ubuntu but it fails with following error:
See error log for details.
A jar cannot be used in order to get the info for the python interpreter.

Any Idea how to resolve this issue???

Smitha said...


Back to you for help/info.

Wanted to confirst if Monkeyrunner support is available for Jelly bean?


Diego Torres Milano said...

Yes, monkeyrunner works with Jelly Bean.

Florin Buda said...

man !! I own you a beer !!

Zellman said...


I have set ANDROID_VIEW_CLIENT_HOME and sys.path includes '/Users/zellman/Development/dtmilano/AndroidViewClient/AndroidViewClient/src', but I get the following error when trying to run in Eclipse:
from import ViewClient #@UnresolvedImport
ImportError: No module named dtmilano

Any ideas?

Zellman said...

For the record, the same script works when run from the command line.

Diego Torres Milano said...

Did you see:

Zellman said...

Yeah, I read that article, which is why I chose PyDev.

I imported AndroidViewClient as a project in Eclipse so I could add it as a project reference and include it as a source folder in the pydev properties for my test project. However, it won't take. Every time I close the properties window it reverts to tests/src instead of AndroidViewClient/src.

I also tried to include the AndroidViewClient src folder as an External Library, but still get the "No module named dtmilano" error.

Diego Torres Milano said...

I'm starting to understand your problem.
Let's start with something simpler:

Can you run from Eclipse some of the examples in AndroidViewClient, let's say

Zellman said...

@Diego, sorry for the delay in response, I got distracted by some other things for a while.

Yes, runs fine in Eclipse. What do you think I should try next?


Zellman said...


If I run from within the examples directory of AndroidViewClient, then it works fine, but if I copy the file out to my other project, it doesn't. Is com.dtmilano... dependent on the working directory being set to AndroidViewClient? I ask because the working directory seems to be the only difference between these two Run Configurations.

Zellman said...

Even more interesting...

If I change the Run Configuration to have AndroidViewClient as the Project, but my script as the Main Module, then it runs fine. Even if I change the working directory to also be my project's home directory.


I was able to delete all .pyclass files, reset all configurations on both the AVC project and my own, and now I'm able to run it just fine. Don't know what the issue was, though