Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Using buildozer and beautifulsoup
#1
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:  
Error:
ImportError: cannot import name _htmlparser 
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/23952...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 BeautifulSoup
However this for me is saying..      
Error:
from bs4 import BeautifulSoup ImportError: No module named 'bs4'
 
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.
Reply


Messages In This Thread
Using buildozer and beautifulsoup - by d4py - Jan-06-2017, 01:15 AM
RE: Using buildozer and beautifulsoup - by Blue Dog - Jan-07-2017, 06:49 PM
RE: Using buildozer and beautifulsoup - by wavic - Jan-07-2017, 08:11 PM
RE: Using buildozer and beautifulsoup - by d4py - Jan-10-2017, 05:07 AM
RE: Using buildozer and beautifulsoup - by wavic - Jan-10-2017, 07:11 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020