Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

object of type 'int' has no len() #7

Closed
thoughtobj opened this issue Feb 11, 2016 · 3 comments
Closed

object of type 'int' has no len() #7

thoughtobj opened this issue Feb 11, 2016 · 3 comments

Comments

@thoughtobj
Copy link

I got the image from docker but when I try to run the example I get the following error:

root@30d50900394b:/opt/ocr# python /opt/ocr/tesseractserver.py -p 1688 -b /root/local/lib -d /root/local/share/tesseract-ocr
Tesseract Web Service starts at port 1688.
ERROR:root:Uncaught exception POST /fetchurl (192.168.99.1)
HTTPRequest(protocol='http', host='192.168.99.100:1688', method='POST', uri='/fetchurl', version='HTTP/1.1', remote_ip='192.168.99.1', body='{"url": "http://www.greatdreams.com/666-magicsquare.gif"}', headers={'Origin': 'chrome-extension://fdmmgilgnpjigdojojpjoooidkmcomcm', 'Content-Length': '57', 'Accept-Language': 'en-US,en;q=0.8', 'Accept-Encoding': 'gzip, deflate', 'Host': '192.168.99.100:1688', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.103 Safari/537.36', 'Connection': 'keep-alive', 'Cache-Control': 'no-cache', 'Content-Type': 'application/json; charset=UTF-8'})
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/tornado/web.py", line 954, in _execute
    getattr(self, self.request.method.lower())(*args, **kwargs)
  File "/opt/ocr/tesseractserver.py", line 125, in post
    result = wrapper.imageUrlToString(url, minWidth)
  File "/opt/ocr/tesseractcapi.py", line 104, in imageUrlToString
    for j in range(len(data[i])):
TypeError: object of type 'int' has no len()
ERROR:root:500 POST /fetchurl (192.168.99.1) 10360.87ms

I can take a shot at fixing it if you can provide some hints on where I should begin.

@guitarmind
Copy link
Owner

Hi,

Thanks for reporting this!
I checked the code and it seems to have something wrong while processing GIF format, I just add a commit to revise it, and it should work now.

Please check this commit:
0f50cb3

@thoughtobj
Copy link
Author

Thanks for a quick turn around on this. That seems to fix the error. I'm able to run the service now, however, the results are very gibberish

Result:  5 —Z //é,réfe-E’T(-:1‘
=,:»<;::»zr«:»::;»*a;»=,
 :;
3"-,ié",é:5~;%: F ‘
-m-nmmnm-wvww-w"'""1'"""""

,i ,; gs?
‘7f7.é="-}:‘:’~?‘*i‘
t>;<;.,¥:,c:r~-

:x£>_ 4-.— .2 ~ - /

I'll try to play around with it and send merge request if I'm able to produce better results.

@guitarmind
Copy link
Owner

Hi,

That would be appreciated if you can help investigate this, as I remembered, this wired output didn't happen before. Anyway, this issue is closed and please share with me if you have any findings, thanks.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants