rtesseract: RTesseract::ConversionError in Ruby on Rails app

  • Installed gems fine, tesseract and imagemagik already installed on server.
  • Running tesseract command manually in terminal works successfully.
  • Running application locally on OS X enviroment works successfully.
uploaded_io = params[:picture]
    File.open(Rails.root.join('public', 'uploads', uploaded_io.original_filename), 'wb') do |file|
      file.write(uploaded_io.read)
    end
    dl = RTesseract.new(Rails.root.join('public', 'uploads',uploaded_io.original_filename).to_s)
    @string = dl.to_s

Only once I’ve deployed to my development server does it all break returning the error. The files are been copied across to the public/uploads folder correctly. And are readable as tested by running the tesseract command outside of ruby on the same file.

The result when running the app is RTesseract::ConversionError on the dl.to_s action

Unsure on what I’m missing…

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Comments: 18 (2 by maintainers)

Most upvoted comments

What fixed it for me was to also install it through brew: brew install tesseract

Hi dannylo,

I am getting this error as well, and have tesseract and ImageMagick installed(I can use both on my terminal). The below is what I would get in my logs:

RTesseract::ConversionError: No such file or directory @ rb_sysopen - /tmp/1451631781.39245151432.txt

This happens when I call the to_s method. Seems like it is creating the txt file but not saving it? I looked in the /tmp folder and confirmed that it is not there.