Tesseract cannot find eng.traineddata - python-3.x

I have python program which uses tesseract ocr engine. At first it worked fine. However I uninstall tesseract and reinstall it this time it does not work.
It gives
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file C:\\Program Files\\Tesseract-OCR/eng.traineddata Please make sure the TESSDATA_PREFIX
I did not change anything, but it does not work.
I add TESSDATA_PREFIX to the path.
But when I move eng.traineddata from tesstada to tesseract-ocr file it worked. I have another computer and also it has same program and it works well. However eng.traineddata is in tessdata folder.
Why is the one program gives an error, another is not ?
EDIT
1) 'C:\Program Files\Tesseract-OCR/eng.traineddata' does not exist in two computers. However one of them is working but the other is not working. Therefore As I stated in the question, I move eng.traineddata from tessdata to Tesseract-OCR folder and then it is worked. But here is the question why one of it is working and the other is not working ? Because other program does not have eng.traineddata in the Tesseract-OCR folder.
2) I downloaded the windows executable of tesseract from mannheim uni library. So file is not corrupted.
3)I am using Tesseract 3.05
4) I have created TESSDATA_PREFIX env variable.
5) I downloaded the windows executable of tesseract from mannheim uni library.
Thank you very much.

Does 'C:\Program Files\Tesseract-OCR/eng.traineddata' exists?
Did you check if file is not corrupted (e.g. you downloaded it correctly)
From which (tessdata repository) source you downloaded it?
Adding TESSDATA_PREFIX to paths is useless: you have to setup env variable TESSDATA_PREFIX.
Provide full code how you setup and run pytesseract. Showing only (part of) error message does not help.

Related

Setting up a path for Haskell-Linter in VS Code on windows 10

I am trying to make haskell-linter to work on VS Code on my windows 10 machine. Apparently you need to add a path to the .exe file for it to work. I get this error message.
Cannot hlint the haskell file. The hlint program was not found. Use the 'haskell.hlint.executablePath' setting to configure the location of 'hlint'
In the Dependencies options there is following information.
It expects a version of hlint >= 1.9.1 to be installed and already added to >the path. If it is installed but cannot be found, add the path to your >preferences as seen below"
"haskell.hlint.executablePath": "Path\To\Executable"
I tried adding a path in the system environment as such.
Variablename: haskell.hlint.executablePath
Variablevalue: C:\Users\name\.vscode\extensions\hoovercj.haskell-linter-0.0.6\node_modules\.bin
I am fairly sure the variable value is the thing wrong here. I think I need to find the path to the .exe file for for the extension, but I can't seem to find it in the folder containing the extension itself. There is probable an easy fix that I am just to inexperienced to see. Please help, and if you do, explain it as if I was 8. :)
Edit 1: I now know where to put the path to what i assume must be the .exe file for Haskell-linter, however i don't know where that file is. As stated i cant find any .exe files in the extension folder.
Edit 2: I reinstalled hlint and added the new path. it finally seems to work as intended.

Anaconda Prompt(Anaconda3) does not recognize files in a directory

I took to heart the message that support for anaconda2 was dropped. I installed anaconda3 and used 2to3 to convert my *.py codes. Everything seemed to work as expected. I have several 2 line bat codes that cd to a particular directory and then call python to execute a particular *.py code in that directory. By loading Anaconda Prompt(Anaconda3) and invoking the bat file I could run pythons in that directory as expected.
Then, a couple of days ago, I made such a run and got an error message saying the *.py file could not be found. I immediately looked in the directory and the python file was there as expected. I then did a dir command in Anaconda Prompt(Anaconda3) and found that almost no files in the directory were listed. This was happening on my windows 10 laptop.
On my desktop, everything continues to work as expected. Are there any suggestions as to what could cause such a problem and how to fix it.
Thanks,
Mack Elrod
Responding to the request for additional information, I have a bin directory that is in path. In bin\MackData.bat is
c:
cd %USERPROFILE%\Documents\Medev\MackData
copy sugarhist.png sugarhist.old.png
python MackData.py
When I open Anaconda Prompt(Anaconda3) and enter MackData I get
(base) C:\Users\Mack>MackData
(base) C:\Users\Mack>c:
(base) C:\Users\Mack>cd C:\Users\Mack\Documents\Medev\MackData
(base) C:\Users\Mack\Documents\Medev\MackData>copy sugarhist.png sugarhist.old.png
1 file(s) copied.
(base) C:\Users\Mack\Documents\Medev\MackData>python MackData.py
python: can't open file 'MackData.py': [Errno 2] No such file or directory
(base) C:\Users\Mack\Documents\Medev\MackData>
But MackData.py is a python file in the directory MackData.
This code worked on this laptop until a few days ago and continues to work on my desktop computer. I can, of course, publish MackData.py but that seems irrelevant. The point is that Anaconda can't find it.
Thanks,
Mack
I must submit a sincere apology to this community. I have determined my problem and Anaconda is not responsible in any way. I thank all of you for you concerns and comments.
For any who might be interested I will give a brief outline of what happened. First, I installed Anaconda3. Several days later my directory, MackData, was moved to a new location. I conjecture that happened by me inadvertently letting my hand drag on the touch pad. Then, not knowing the location had changed I updated my laptop from my desktop. My update program not finding MackData where expected recreated it and put only the most recently changed files from the desktop into the new MackData. New but in the correct location. Then of course running my script in the Anaconda3 prompt failed. Doing a dir in the Anaconda3 prompt showed only a few files were there. I then went to Windows File Explore and looked at MackData and saw all of the expected files. I used the quick access feature which unknown to me pointed to the old directory in its new location.
That is not intended to be an excuse but only as an explanation. Again, I do apologize to the community.
Mack Elrod
I'm pretty sure newer anaconda launchers users different environment paths, and not even windows ones.
I suggest either checking the environment path within the anaconda launcher and configurations or, a better solution in my opinion, run these scrips using the regular python engine, without using anaconda (simpler, more determinant and works within your standard environment)

How to convert file .py to .exe, having Python from Anaconda Navigator? (in which command prompt should I write installation codes?)

I created a Python script (format .py) that works.
I would like to convert this file to .exe, to use it in a computer without having Python installed.
How can I do?
I have Python from Anaconda3.
What can I do?
Thank you!
I followed some instruction found here on Stackoverflow.
.I modify the Path in the 'Environment variables' in the windows settings, edited to the Anaconda folder.
.I managed to install pip in conda prompt (I guess).
Still, nothing is working. I don't know how to proceed and in general how to do things properly.
I personaly use pyinstaller, its available from pip.
But it will not really compile, it will just bundle.
The difference is compiling means translating to real machine code while bundling is creating a big exe file with all your libs and your python interpreter.
Even if pyinstaller create bigger file and is slower than cython (at execution), I prefer it because it work all the time without work (except lunching it).

How to install and get started with moai on Ubuntu?

I am trying to install moai on Ubuntu.
I tried following this: https://github.com/moai/moai-dev/wiki/Building-MOAI-on-Ubuntu-14.10-64bit
and completed all the steps. It seemed as if everything completed. But now I don't know what to do.
How to run moai ?
I somewhere saw it was mentioned to run
moai main.lua
However I tried
which moai
without any result.
I thought that moai isn't in my PATH but I don't know which location to add to my PATH variable, because there isn't any file in moai-dev/bin folder of the name moai on my PC.
Please Help.
You can just download moai binary release which is available for linux, osx and windows. After unpacking just put moaidist/linux/moai in your PATH.

cx-freeze can't create .exe file

I have wrote a simple Python script for searching files & finding the duplicates as I am currently learning Python. Nothing complicated at all. This is also my first try of using cx-freeze to build an Windows executable. I'm using Python 3.3.
I'm using the included cxfreeze script to create .exe file. So, I've typed cxfreeze search.py --target-dir dist . Everything goes OK during buildup, and I get the 'dist' folder with files in my home directory (using Lubuntu Linux). Problem is, the Lubuntu recognises the file with the name 'search' as executable, but it hasn't got an .exe extension. On the Windows platform, it is showed just as an file without an extension. So when I try to run it on Windows XP, it just won't work. Adding an .exe extension also do not help.
Do someone have a clue what am I doing wrong?
Thanks.

Resources