有没有一种方法可以将BeautifulSoup (或类似于web抓取的东西)导入到猴运行程序?
将BeautifulSoup导入Python程序是成功的。然而,当导入到monkeyrunner时,我得到了importError。
ImportError: No module named bs4在深入研究之后,我附加了BeautifulSoup路径名
导入sys sys.path.append("path/to/monkeyrunner/directory/the_filename.egg") sys.path.append("path/to/monekeyrunner/directory")
这使Monkeyrunner能够正确地看到BeautifulSoup的目录。但是,抱怨BeautifulSoup中的某些内容;请参见下面的内容:
from bs4 import BeautifulSoup
SyntaxError: ("no viable alternative at input '' ''", ('C:\\Python27\\lib\\site-
packages\\bs4\\__init__.py', 186, 56, " if ((isinstance(markup, b
ytes) and not b' ' in markup)\n"))同样,导入到python时没有错误。有什么建议可以解释为什么猴跑者会是这样吗?
发布于 2015-03-20 17:07:44
您可以尝试AndroidViewClient/culebra,它是100%的python。它将为您提供几乎所有的monkeyrunner功能和更多功能。
可以在脚本中导入bs4,没有任何问题。
https://stackoverflow.com/questions/29148198
复制相似问题