I would expect just some text, as with proc:system("ls")
<result> <output>Usage: /usr/local/bin/tesseract --help | --help-extra | --version /usr/local/bin/tesseract --list-langs /usr/local/bin/tesseract imagename outputbase [options...] [configfile...]
OCR options: -l LANG[+LANG] Specify language(s) used for OCR. NOTE: These options must occur before any configfile.
Single options: --help Show this help message. --help-extra Show extra help for advanced users. --version Show version information. --list-langs List available languages for tesseract engine. </output> <code>1</code> </result>
I guess that the "1" code blocks the printing. If I use proc:system("/usr/local/bin/tesseract", "--help"), it works.
E-mail: celano@informatik.uni-leipzig.de mailto:celano@informatik.uni-leipzig.de Web site 1: http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano http://asv.informatik.uni-leipzig.de/en/staff/Giuseppe_Celano Web site 2: https://sites.google.com/site/giuseppegacelano/ https://sites.google.com/site/giuseppegacelano/
On Nov 13, 2019, at 6:48 PM, Christian Grün christian.gruen@gmail.com wrote:
Interestingly, proc:execute("/usr/local/bin/tesseract") works (I have BaseX 9.2).
How does the output look like?
proc:system("/usr/local/bin/tesseract") returns the following:
If the code 1 is raised, it indicates that your command will be executed indeed, but it returns the exit code 1. Which output would you expect?
SET DEBUG true
DEBUG: true
XQUERY proc:system("/usr/local/bin/tesseract")
org.basex.query.QueryException: at org.basex.query.func.proc.ProcSystem.item(ProcSystem.java:26) at org.basex.query.expr.ParseExpr.value(ParseExpr.java:50) at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:45) at org.basex.query.scope.MainModule.iter(MainModule.java:97) at org.basex.query.QueryContext.iter(QueryContext.java:332) at org.basex.query.QueryProcessor.iter(QueryProcessor.java:90) at org.basex.core.cmd.AQuery.query(AQuery.java:107) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) at org.basex.api.client.LocalSession.execute(LocalSession.java:132) at org.basex.api.client.Session.execute(Session.java:36) at org.basex.core.CLI.execute(CLI.java:92) at org.basex.core.CLI.execute(CLI.java:76) at org.basex.BaseX.console(BaseX.java:176) at org.basex.BaseX.<init>(BaseX.java:151) at org.basex.BaseX.main(BaseX.java:42) org.basex.core.BaseXException: Stopped at ., 1/12: [proc:code0001] at org.basex.core.Command.execute(Command.java:94) at org.basex.api.client.LocalSession.execute(LocalSession.java:132) at org.basex.api.client.Session.execute(Session.java:36) at org.basex.core.CLI.execute(CLI.java:92) at org.basex.core.CLI.execute(CLI.java:76) at org.basex.BaseX.console(BaseX.java:176) at org.basex.BaseX.<init>(BaseX.java:151) at org.basex.BaseX.main(BaseX.java:42) Caused by: org.basex.query.QueryException: at org.basex.query.func.proc.ProcSystem.item(ProcSystem.java:26) at org.basex.query.expr.ParseExpr.value(ParseExpr.java:50) at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:45) at org.basex.query.scope.MainModule.iter(MainModule.java:97) at org.basex.query.QueryContext.iter(QueryContext.java:332) at org.basex.query.QueryProcessor.iter(QueryProcessor.java:90) at org.basex.core.cmd.AQuery.query(AQuery.java:107) at org.basex.core.cmd.XQuery.run(XQuery.java:22) at org.basex.core.Command.run(Command.java:257) at org.basex.core.Command.execute(Command.java:93) ... 7 more Stopped at ., 1/12: [proc:code0001]
On Nov 13, 2019, at 5:50 PM, Christian Grün christian.gruen@gmail.com wrote:
Hi Giuseppe,
When I try to run proc:system("/usr/local/bin/tesseract") I get the error [proc:code0001]
On my system, I get the (expected) error…
[proc:error] Cannot run program "/usr/local/bin/tesseract": CreateProcess error=2, Das System kann die angegebene Datei nicht finden
…so we may need to find out what code 1 means in your case. Could you run the query with debugging enabled and pass us on the stack trace?
And your error code indicates that you are using an older version of BaseX. Does it work with a more recent version? If not, what do you get?
Best, Christian
Similarly:
proc:system("tesseract") returns [proc:error] Cannot run program "tesseract": error=2, No such file or directory
Similarly:
proc:system("tesseract", (), map {"dir" : "/usr/local/bin/"}) returns [proc:error] Cannot run program "tesseract" (in directory "/usr/local/bin"): error=2, No such file or directory
The command "tesseract" works at the command line. I suspect there may be a problem with permissions: is there a way to overcome this error? Thanks.
Best, Giuseppe