Using tesseract in Python3 textract library
<p>I would like to extract text from PDF files. I could successfully install tesseract (it works in Terminal) and textract (following <a href="http://www.tysonmaly.com/installing-textract-for-python-3/" rel="nofollow">this</a> instruction).</p>

<p>However, when I run the code, I got an error.</p>

<pre><code>text = textract.process(
    '/Users/Text/en.pdf',
    method='tesseract',
    language='eng',
)
</code></pre>

<p>Error is:</p>

<pre><code>/usr/local/lib/python3.4/site-packages/textract-1.4.0-py3.4.egg/textract/parsers/pdf_parser.py in extract_tesseract(self, filename, **kwargs)
     62                 page_content = TesseractParser().extract(page_path, **kwargs)
     63                 contents.append(page_content)
---&gt; 64             return ''.join(contents)
     65         finally:
     66             shutil.rmtree(temp_dir)

TypeError: sequence item 0: expected str instance, bytes found
</code></pre>

<p>I tried several modifications, but they never work and I got the same error.  </p>

<ol>
<li><code>return b''.join(contents)</code></li>
<li>Insert <code>contents = [str(item) for item in contents]</code> before <code>return</code></li>
<li>Insert <code>contents = [item.decode("utf-8") for item in contents]</code> before <code>return</code></li>
</ol>