1
I am trying to run tesseract on windows10 (home ed), but this question is really more generic. Sources and instructions to run the program are here. I am running a downloaded windows binary, not a native build (I also tried a cygwin version, with slightly worse results, see below).
I started up powershell in administrator mode (by right-clicking and selecting "Run as administrator") and ran from the command line in a folder on the Desktop containing the image on which to perform OCR:
>tesseract image.jpg out
The shell responds with
>Tesseract with Open Source OCR Engine v3.02 with Leptonica
but balks when it comes to the write step with error:
>Cannot create ouput file out.txt
If I run with powershell ISE I get more output:
> tesseract : Tesseract Open Source OCR Engine v3.02 with Leptonica At
> line:1 char:1
> + tesseract image.jpg out
> + ~~~~~~~~~~~~~~~~~~~~~~~~~
> + CategoryInfo : NotSpecified: (Tesseract Open ... with Leptonica:String) [], RemoteException
> + FullyQualifiedErrorId : NativeCommandError
> Cannot create output file out.txt
I tried altering permissions in powershell with
>Set-ExecutionPolicy AllSigned -Scope Process -Force
and
>Set-ExecutionPolicy Unrestricted -Scope Process -Force
but no change resulted.
Note I also tried running a tesseract version for cygwin from the cygwin bash but shell responds to any tesseract command with a blank line:
>
and nothing written.
Note however (following advice given in a comment) that if I specify the full output file path as pointing to the Downloads folder then writing does work for the windows binary (not for the cygwin version).
I am coming up short on a general solution on how to give write permissions to executables or scripts run on windows 10 powershell (or cygwin). I am sure there must be gazillions of answers but strangely can't find one that is beginner-friendly. For instance If I search for "write to folder permission windows10" I come up with nothing on superuser and sparsely explained and ad-heavy answers such as this if I cast a wider net. How do I run tesseract (really any shell script or exe run from the shell, that requires write permissions to a user-defined folder) on windows10 ? Are there authorative but user-friendly (as in, quick) guides on how to do this?
have you tried running powershell as administrator? – LPChip – 2019-11-29T10:30:32.500
Where are you running the command from? Have you tried specifying a full path in a writable area for the output file? This isn't a powershell problem, it's the directory you are writing in/to. – Mokubai – 2019-11-29T10:34:24.420
I open powershell with mouse clicking (right mouse click, tehn choose "Run as administrator"), then cd to the folder containing the image file which is a folder on my desktop. – Buck Thorn – 2019-11-29T10:36:34.877
@LPChip @Mokubai I tried specifying the local dir with
./out
or the full path to the folder but that doesn't lead to writing. On the other hand I had a virus protection message from windows pop up. – Buck Thorn – 2019-11-29T10:44:50.103I tried disabling app blocking under windows security by checking the off selection under "Check apps and files" but this doesnt make a difference – Buck Thorn – 2019-11-29T10:46:35.667
@Mokubai Thanks, you are right about the folder permissions. The program works in the downloads folder :-\ However how to change write permissions on some other folder, eg Desktop? Why is desktop of all places not writable?? – Buck Thorn – 2019-11-29T11:09:21.837
I am surprised that searching for "write to folder permission windows10" on superuser does not give an answer... – Buck Thorn – 2019-11-29T11:18:16.777
First, take a step back. Under no circumstances should it be required to run regular software with admin rights. What folder are you currently in when running
tesseract
? If possible provide the full path. – Daniel B – 2019-11-29T14:15:04.487@DanielB I have attempted running tesseract from the Desktop (C:/Users/xxX/Desktop); then a windows security virus interception alert pops up. Under a folder under Desktop I also can't write but no popup shows. I have tried disabling some of the virus blocking as mentioned above but that doesnt help. – Buck Thorn – 2019-11-29T14:21:45.670
Do you have “Controlled folder access” enabled in Windows Defender? – Daniel B – 2019-11-29T14:31:17.903
@DanielB Hmm, looks like Desktop is under the "protected folders". That is probably it, huh? – Buck Thorn – 2019-11-29T14:40:16.147
Thanks for your help @DanielB – Buck Thorn – 2019-11-29T16:38:14.617