Pyocr doesn't recognize get_available_tools
Question: I'm using <https://pypi.python.org/pypi/pyocr/0.1.2> for text recognition from
images my script is as follows :

    
    
    from PIL import Image
    import sys
    import pyocr
    import pyocr.builders
    
    tools = pyocr.get_available_tools()
    if len(tools) == 0:
        print("No OCR tool found")
        sys.exit(1)
    tool = tools[0]
    print("Will use tool '%s'" % (tool.get_name()))
    
    langs = tool.get_available_languages()
    print("Available languages: %s" % ", ".join(langs))
    lang = langs[0]
    print("Will use lang '%s'" % (lang))
    
    txt = tool.image_to_string(Image.open('http://www.domain.com/fr/i/3518721/phone'),
                               lang=lang,
                               builder=pyocr.builders.TextBuilder())
    word_boxes = tool.image_to_string(Image.open('http://www.domain.com/fr/i/3518721/phone'),
                                      lang=lang,
                                      builder=pyocr.builders.WordBoxBuilder())
    line_and_word_boxes = tool.image_to_string(
            Image.open('http://www.domain.com/fr/i/3518721/phone'), lang=lang,
            builder=pyocr.builders.LineBoxBuilder())
    

when I run the script i have this error message :

> Traceback (most recent call last): File "./test.py", line 6, in tools =
> pyocr.get_available_tools() AttributeError: 'module' object has no attribute
> 'get_available_tools'

What seems to be the problem officers?


Answer: Change your imports to look like this:

    
    
    from PIL import Image
    import sys
    from pyocr import pyocr
    from pyocr import builders
    

Now `pyocr.get_available_tools()` will work because you have imported the
module. But `pyocr.builders.WordBoxBuilder()` wont work because builders is
imported on its own namespace. You'd need to change them to
`builders.WordBoxBuilder()` ditto for TextBuilder and LineBoxBuilder.

