首页 > 代码库 > eclipse+pydev+python+MonkeyRunner开发环境
eclipse+pydev+python+MonkeyRunner开发环境
在编辑开发过程中,无法实现注释,一注释就会报错,如下图所示:
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] Script terminated due to an exception
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions]SyntaxError: Non-ASCII character in file ‘D:\JavaWork\MonkeyRunnerTest\src\uninstallapk.py‘, but no encoding declared; see http://www.python.org/peps/pep-0263.html for details
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.SyntaxError(Py.java:166)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.ParserFacade.fixParseError(ParserFacade.java:102)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.ParserFacade.parse(ParserFacade.java:184)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.Py.compile_flags(Py.java:1731)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.core.__builtin__.execfile_flags(__builtin__.java:514)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:225)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.ScriptRunner.run(ScriptRunner.java:116)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.run(MonkeyRunnerStarter.java:77)
141108 14:13:01.264:S [main] [com.android.monkeyrunner.MonkeyRunnerOptions] at com.android.monkeyrunner.MonkeyRunnerStarter.main(MonkeyRunnerStarter.java:189)
出现如上错误的原因是没有加一条
#-*- coding: UTF-8 -*- 注释
原因是中文不识别,需要加一个字符码注释
还有别的方式可以解决 比如在windows->preferences里面设置的话 但是我试了 还是会报错
eclipse+pydev+python+MonkeyRunner开发环境