GithubHelp home page GithubHelp logo

pyocr with latest Tesseract fails with pyocr.error.TesseractError: "Error, unknown command line argument '-psm'\n") about pyocr HOT 5 OPEN

ddddavidmartin avatar ddddavidmartin commented on June 11, 2024
pyocr with latest Tesseract fails with pyocr.error.TesseractError: "Error, unknown command line argument '-psm'\n")

from pyocr.

Comments (5)

ddddavidmartin avatar ddddavidmartin commented on June 11, 2024

Having a look through the pyocr sources this stands out to me:

src/pyocr/builders.py
307-        file_ext = ["txt"]
308:        tess_flags = ["-psm", str(tesseract_layout)]
309-        cun_args = ["-f", "text"]
--
564-        file_ext = ["html", "hocr"]
565:        tess_flags = ["-psm", str(tesseract_layout)]
566-        tess_conf = ["hocr"]
--
640-        file_ext = ["html", "hocr"]
641:        tess_flags = ["-psm", str(tesseract_layout)]
642-        tess_conf = ["hocr"]

Does pyocr just use -psm instead of --psm as the parameter? I'm wondering whether that is not accepted anymore now.

from pyocr.

ddddavidmartin avatar ddddavidmartin commented on June 11, 2024

Does pyocr just use -psm instead of --psm as the parameter? I'm wondering whether that is not accepted anymore now.

It looks like this is the problem. I have changed the passed options in builds.py to provide --psm instead of -psm and it works fine now. I might create a pull request for this though I'm not sure whether there are any other implications of this.

The commit in question in tesseract is the following:
tesseract-ocr/tesseract@ee201e1

from pyocr.

simonm3 avatar simonm3 commented on June 11, 2024

I also came across this today. I note that -psm is used not just in builders.py but also in tesseract.py.

from pyocr.

jflesch avatar jflesch commented on June 11, 2024

#100

from pyocr.

ddddavidmartin avatar ddddavidmartin commented on June 11, 2024

I haven't had a chance yet to work out the circular import statements that I introduced in https://github.com/ddddavidmartin/pyocr/tree/update_deprecated_psm_option_string. If anyone wants to step in, feel free to give it a go.

For now, a quick and dirty fix is to just apply c136838.

from pyocr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.