title: problems with monkeyrunner
body: <p>I am working on making some changes to the android framework layer and building my own version. I am working based on froyo and trying to use monkeyrunner for some testing. I have pulled the source and can build and run in the emulator but when I try to use a monkeyrunner script I can't seem to get anyhting to work. I built the code using lunch full-eng and it runs fine on the device. I am just trying to get a simple script running based on the example at <a href="http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html" rel="nofollow">http://developer.android.com/guide/developing/tools/monkeyrunner_concepts.html</a> shown below with a print statement added just to see if I could get anything to run.</p>
  
  <pre><code>/# Imports the monkeyrunner modules used by this program
  from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
  
  /# Connects to the current device, returning a MonkeyDevice object
  device = MonkeyRunner.waitForConnection()
  
  print "Hello World!"
  </code></pre>
  
  <p>When the following line is in the script I get an error as follows.</p>
  
  <blockquote>
    <p>from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice</p>
    
    <p>Traceback (most recent call last):
        File "../../MRTesting/MyTest.py, line 4, in 
            from com.android.monkeyrunner import MonkeyRunner, MonkeyDevice
    ImportError: cannot import name MonkeyDevice</p>
  </blockquote>
  
  <p>So if I remove MonkeyDevice from the import as shown below I get a different error on the call to waitForConnection()</p>
  
  <blockquote>
    <p>from com.android.monkeyrunner import MonkeyRunner</p>
    
    <p>Traceback (most recent call last):
        File "../../MRTesting/MyTest.py, line 6, in 
            device = MonkeyRunner.waitForConnection()
    AttributeError: type object 'com.android.monkeyrunner.MonkeyRunner' has no attribute 'waitForConnection'</p>
  </blockquote>
  
  <p>I tried modifying the call to have some arguments as indicated in the documentation as follows but I still get the same error. The second argument matches the value returned by a call to adb devices.</p>
  
  <pre><code>device = MonkeyRunner.waitForConnection(5, 'emulator-5554')
  </code></pre>
  
  <p>I have done some digging around and one person said that the shebang needs to be at the beginning of the file as follows with the path modified to avoid putting information in I would rather not share.</p>
  
  <pre><code>/#! /home/&lt;path&gt;/monkeyrunner
  </code></pre>
  
  <p>I could not see how this would be any different than me invoking monkeyrunner directly from the command line but I tried it and no luck. I did not install the sdk anywhere on my system as it is included in the build tree but it seems to me that the monkeyrunner tool might not be able to locate it as needed but I can't find any indication of how to fix this. I am running the following commands when I build my system from within my build directory at the root.</p>
  
  <pre><code>. build/envsetup.sh
  setpaths
  lunch full-eng
  make -j16
  </code></pre>
  
  <p>Anyone have any thoughts on this?</p>