Using buildozer and beautifulsoup - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html) +--- Thread: Using buildozer and beautifulsoup (/thread-1470.html) |
Using buildozer and beautifulsoup - d4py - Jan-06-2017 Hi everyone. I have a program that works fine on my PC but when I try to use buildozer to get it on to my tablet or phone, it installs ok but doesn't load when you run it. Looking at the logcat, it says: So I have had a look around and a few others have had this problem and have solved it. However, as I am very much a newbie at coding at the moment, I can't seem to see how to solve it exactly and so wanted to see if anyone could help me work out the solution.. The stackoverflow thread is here: http://stackoverflow.com/questions/23952484/buildozer-compiles-apk-but-it-crashes-on-android The code that I'm trying to run that apparently fixed the issue is here: import imp import sys class ImportBlocker(object): def __init__(self, *args): self.black_list = args def find_module(self, name, path=None): if name in self.black_list: return self return None def load_module(self, name): module = imp.new_module(name) module.__all__ = [] # Necessary because of how bs4 inspects the module return module sys.meta_path = [ImportBlocker('bs4.builder._htmlparser')] from bs4 import BeautifulSoupHowever this for me is saying.. Without the above code.. there is no problem importing the bs4 module. Am I missing something obvious? Many thanks for any guidance! Greatly appreciate it. RE: Using buildozer and beautifulsoup - Blue Dog - Jan-07-2017 try this; from BeautifulSoup import BeautifulSoup RE: Using buildozer and beautifulsoup - wavic - Jan-07-2017 Import the bs4 module along with the other import statement. RE: Using buildozer and beautifulsoup - d4py - Jan-10-2017 If I change to "from BeautifulSoup import BeautifulSoup" it says: ImportError: No module named 'BeautifulSoup' If I import the bs4 with the other import, weirdly it then says that the next module import underneath is not found.. "No module named 'xmltodict" or if I put after all imports.. and above the kivy classes, it says "ImportError: No module named 'kivy.core.window'" It's almost like it's just blocking the very next thing regardless. I thought that its aim was to block the html parser only? If there's another library I could use, I don't mind redoing it again... perhaps feedparser? RE: Using buildozer and beautifulsoup - wavic - Jan-10-2017 lxml? |