HI,
I install python-tesseract
(http://code.google.com/p/python-tesseract/downloads/detail?name=python-tesseract-0.7.6.win32-py2.7.exe&can=2&q=),
it's work fine on Python interpreter (Win32).
But, i can't import tesseract module on web2py source code version 2.0.9.
What did I do wrong?
Thanks.
Traceback (most recent call last):
File "D:\web2py2.0\gluon\restricted.py", line 209, in restricted
exec ccode in environment
File "D:/web2py2.0/applications/app/controllers/plugin_qa.py"
<http://127.0.0.1:8000/admin/default/edit/app/controllers/plugin_qa.py>, line
101, in <module>
File "D:\web2py2.0\gluon\globals.py", line 186, in <lambda>
self._caller = lambda f: f()
File "D:/web2py2.0/applications/app/controllers/plugin_qa.py"
<http://127.0.0.1:8000/admin/default/edit/app/controllers/plugin_qa.py>, line
81, in index
import tesseract
File "D:\web2py2.0\gluon\custom_import.py", line 298, in __call__
raise e
ImportError: Cannot import module 'tesseract'
My controller:
def index():
import tesseract
api = tesseract.TessBaseAPI()
api.Init(".","eng",tesseract.OEM_DEFAULT)
api.SetVariable("tessedit_char_whitelist",
"0123456789abcdefghijklmnopqrstuvwxyz")
api.SetPageSegMode(tesseract.PSM_AUTO)
mImgFile = "E:\test.png"
mBuffer=open(mImgFile,"rb").read()
result = tesseract.ProcessPagesBuffer(mBuffer,len(mBuffer),api)
print "result(ProcessPagesBuffer)=",result
response.view = 'plugin_app/content.%s'%request.extension
content = result
return dict(content=content)
--