Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Call audiveris from python script #289

Closed
misterpilou opened this issue Jun 10, 2019 · 4 comments
Closed

Call audiveris from python script #289

misterpilou opened this issue Jun 10, 2019 · 4 comments

Comments

@misterpilou
Copy link

I made a very basic script with python with

subprocess.run(["Audiveris", "-batch", "-export", f"./scores_data/{directory}/{sub}/{f}"])

because my pdf was on differents folders, but resulting in a Failed loading language 'langcode'.

I would like to know how to get it through, PREFIX_TESSDATA is set and i got all traineddata within. One option would be to disable TEXT step.

Errors are:

Failed loading language 'deu'
Failed loading language 'eng'
Failed loading language 'fra'
Tesseract couldn't load any languages!

@maximumspatium
Copy link
Contributor

maximumspatium commented Jun 11, 2019

I would like to know how to get it through, PREFIX_TESSDATA is set and i got all traineddata within.

Add the following code to your script and run it:

print ('Tesseract data is set to %s' % os.environ['TESSDATA_PREFIX'])

What do you see?

It would be helpful to know what OS you're running on and which version of Tesseract is installed by default. To obtain the latter, run the following command in your terminal:

tesseract --version

One option would be to disable TEXT step.

This is really undesirable because Audiveris will try to map every text letter to a musical symbol resulting in a complete mess...

@misterpilou
Copy link
Author

misterpilou commented Jun 11, 2019

Thanks for your reply and sorry for not telling all the infos:
Tesseract version: 4.0.0
Audiveris version: 5.1.1 (both are up to date)
I set in my python code the:
os.environ["TESSDATA_PREFIX"] = "/usr/share/tesseract-ocr/4.00/tessdata/"

@maximumspatium
Copy link
Contributor

Tesseract 4.0 isn't supported yet, this comment explains why.

Audiveris requires tesseract 3.x and the appropriate language files. Your TESSDATA_PREFIX points to 4.x language files which are incompatible with Tesseract 3.x.

Please downgrade Tesseract to 3.x including its language files and everything should work as expected.

Please be careful while setting TESSDATA_PREFIX - it should be set to the parent directory of your "tessdata" directory.

@misterpilou
Copy link
Author

Thank @maximumspatium for the help, to anyone with the same issue:
In ubuntu 18.04 i followed this to install tesseract 3.05, i move the tessdata from the link to /usr/share/tesseract-ocr/3.05/tessdata and pointed it in my TESSDATA_PREFIX. As the link said either the parent or tessdata directory work, for me it was the tessdata. I close it, thanks again =)

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

No branches or pull requests

2 participants