Is there a way to import BeautifulSoup (or something similar for web scraping) to monkeyrunner?
Importing BeautifulSoup to Python program was successful. However, I was getting the importError when importing to monkeyrunner
ImportError: No module named bs4
After some digging, I appended the BeautifulSoup path name
import sys
sys.path.append("path/to/monkeyrunner/directory/the_filename.egg") sys.path.append("path/to/monekeyrunner/directory")
This enabled Monkeyrunner to correctly see the directory for BeautifulSoup. However, complains about something in BeautifulSoup; see below:
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"))
Again, there is no error with importing to python. Any suggestion as to why this might be the case with monkeyrunner?
You can try AndroidViewClient/culebra which is 100% python. It will provide you with almost all the functionality in monkeyrunner
and more.
bs4
can be imported in your script with no problems.