Trying to run simple monkeyrunner python script, 'importerror no module named os'

后端 未结 4 1986
轮回少年
轮回少年 2021-01-15 13:16

I have the android emulator/SDK installed on my computer, and I\'m trying to run a simple python script, but it fails on the \'import os\' line (which should be standard!)

相关标签:
4条回答
  • 2021-01-15 13:53

    The solution of this problem (and the problem itself explained) can be found at http://dtmilano.blogspot.ca/2013/05/monkeyrunner-importerror-no-module.html.

    Basically, you have to replace jython-2.5.3.jar by jython-standalone-2.5.3.jar, at least until Android SDK Tools Rev. 22.0.1 is out.

    0 讨论(0)
  • 2021-01-15 13:55

    all by itself in the jython interpreter

    If you're using the jython packaged with the Android SDK, it doesn't include an 'os' module by default. You'll need to grab one, and put it in there, or use another interpreter.

    0 讨论(0)
  • 2021-01-15 13:57

    The issue is that the latest versions of the Android SDK include jython-2.5.3 which do not have the os and other importable libraries built in. I found an old copy of the SDK and used the old JAR which appears to have that embedded in it those libraries.

    0 讨论(0)
  • 2021-01-15 14:02

    I resolved this issue with java 1.7.0_21.

    0 讨论(0)
提交回复
热议问题