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

Unparseable command line argument: 'to'. #105

Closed
XtrumE opened this issue Feb 15, 2024 · 17 comments
Closed

Unparseable command line argument: 'to'. #105

XtrumE opened this issue Feb 15, 2024 · 17 comments
Assignees

Comments

@XtrumE
Copy link

XtrumE commented Feb 15, 2024

Hello!

On Win11 running d2t.bat the error "Unparseable command line argument: 'to'." occurs.

The log says further:

"Usage: com.xmlcalabash.drivers.Main [switches/options] [pipeline.xpl] [options]

or: com.xmlcalabash.drivers.Main [switches/options] { [inputs/parameters] step [options] }+"

What can I do to fix this?

@gimsieke
Copy link
Contributor

Can you give your whole invocation line and also the full path of the directory from which you invoke it? In addition, the output of java -version, please.

You can try to invoke it from a directory that has no space or special characters, and also avoid these characters in the file name.

Maybe related to #81 and #82.

@XtrumE
Copy link
Author

XtrumE commented Feb 16, 2024

The docx2tex directory is located in C:/ and the file that I want to convert is in C:/docx2tex.

I tried:

C:\docx2tex>d2t.bat "01 Technik.docx"

After that, the terminal showed the following messages:

starting docx2tex
[info] Unzipping: C:/docx2tex/01 Technik.docx ==> C:/docx2tex/01 Technik.docx.tmp
[info] Unzipped 40 files
[info] Unzip finished successfully.
Errors encountered while running docx2tex. Please see C:/docx2tex/01 Technik.log for details.

The log says:

[main] INFO com.xmlcalabash.runtime.XAtomicStep - xml2tex/xpl/load-config.xpl:60:15:params: coll-xsl yes || elt-name: xsl:param || att-name: name
[main] INFO com.xmlcalabash.runtime.XAtomicStep - xml2tex/xpl/load-config.xpl:60:15:params: coll-xsl yes || elt-name: xsl:key || att-name: name
[main] INFO com.xmlcalabash.runtime.XAtomicStep - xml2tex/xpl/load-config.xpl:60:15:params: coll-xsl yes || elt-name: xsl:variable || att-name: name
[main] INFO com.xmlcalabash.runtime.XAtomicStep - xml2tex/xpl/load-config.xpl:60:15:params: coll-xsl yes || elt-name: xsl:template || att-name: name
[main] INFO com.xmlcalabash.runtime.XAtomicStep - xml2tex/xpl/load-config.xpl:60:15:params: coll-xsl yes || elt-name: xsl:template || att-name: match
[main] INFO com.xmlcalabash.runtime.XAtomicStep - xml2tex/xpl/load-config.xpl:60:15:params: coll-xsl yes || elt-name: xsl:function || att-name: name
Message: Mode: insert-xpath debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/01.insert-xpath.xml
Warning at xsl:function on line 157 column 92 of numbering.xsl:
The option xsl:function/@saxon:memo-function is ignored because it requires a Saxon-PE license
Warning at xsl:output on line 88 column 7 of main.xsl:
XTSE0090 Unrecognized attribute in Saxon namespace: saxon:suppress-indentation
Message: Mode: insert-doc-defaults debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/01a.insert-doc-defaults.xml
Message: Mode: docx2hub:resolve-tblBorders debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/03b.docx2hub_resolve-tblBorders.xml
Message: Mode: docx2hub:add-props debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/04.docx2hub_add-props.xml
Message: Mode: docx2hub:props2atts debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/05.docx2hub_props2atts.xml
Message: Mode: docx2hub:remove-redundant-run-atts debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/07.docx2hub_remove-redundant-run-atts.xml
Message: Mode: docx2hub:join-instrText-runs debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/08.docx2hub_join-instrText-runs.xml
Message: Mode: docx2hub:field-functions debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/14.docx2hub_field-functions.xml
[main] INFO com.xmlcalabash.runtime.XAtomicStep - xproc-util/xslt-mode/xpl/xslt-mode.xpl:116:27:Number of lookaround paragraphs for inline field functions: 0
Message: Mode: wml-to-dbk debugs into file:https:///C:/docx2tex//01.debug/docx2hub/01/20.wml-to-dbk.xml
java.lang.NullPointerException: Cannot invoke "java.io.Reader.read(char[], int, int)" because "reader" is null
at net.sf.saxon.functions.UnparsedTextFunction.readFile(UnparsedTextFunction.java:182)
at net.sf.saxon.functions.UnparsedTextFunction.readFile(UnparsedTextFunction.java:76)
at net.sf.saxon.functions.UnparsedText.evalUnparsedText(UnparsedText.java:142)
at net.sf.saxon.functions.UnparsedText.call(UnparsedText.java:49)
at net.sf.saxon.functions.UnparsedText.call(UnparsedText.java:33)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:548)
at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:852)
at net.sf.saxon.expr.parser.Evaluator$6.evaluate(Evaluator.java:173)
at net.sf.saxon.expr.SystemFunctionCall.evaluateArguments(SystemFunctionCall.java:454)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:546)
at net.sf.saxon.expr.parser.Evaluator$11.evaluate(Evaluator.java:290)
at net.sf.saxon.expr.parser.ExpressionTool.eagerEvaluate(ExpressionTool.java:317)
at net.sf.saxon.expr.TryCatch.iterate(TryCatch.java:279)
at net.sf.saxon.expr.instruct.ForEach.map(ForEach.java:584)
at net.sf.saxon.expr.ContextMappingIterator.next(ContextMappingIterator.java:61)
at net.sf.saxon.om.MemoSequence$ProgressiveIterator.next(MemoSequence.java:228)
at net.sf.saxon.functions.Exists$1.effectiveBooleanValue(Exists.java:69)
at net.sf.saxon.expr.instruct.Choose.choose(Choose.java:966)
at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:940)
at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:746)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:264)
at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:372)
at net.sf.saxon.expr.parser.ExpressionTool.getIteratorFromProcessMethod(ExpressionTool.java:643)
at net.sf.saxon.expr.instruct.Instruction.iterate(Instruction.java:374)
at net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:283)
at net.sf.saxon.expr.ItemChecker.evaluateItem(ItemChecker.java:255)
at net.sf.saxon.expr.parser.Evaluator$6.evaluate(Evaluator.java:173)
at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:545)
at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:737)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:384)
at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:568)
at net.sf.saxon.trans.rules.TextOnlyCopyRuleSet.process(TextOnlyCopyRuleSet.java:72)
at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:530)
at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:661)
at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:360)
at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:349)
at com.xmlcalabash.library.XSLT.run(XSLT.java:230)
at com.xmlcalabash.runtime.XAtomicStep.run(XAtomicStep.java:388)
at com.xmlcalabash.runtime.XCompoundStep.run(XCompoundStep.java:267)
at com.xmlcalabash.runtime.XTry.run(XTry.java:104)
at com.xmlcalabash.runtime.XPipeline.doRun(XPipeline.java:232)
at com.xmlcalabash.runtime.XPipeline.run(XPipeline.java:142)
at com.xmlcalabash.runtime.XPipelineCall.run(XPipelineCall.java:94)
at com.xmlcalabash.runtime.XPipeline.doRun(XPipeline.java:232)
at com.xmlcalabash.runtime.XPipeline.run(XPipeline.java:142)
at com.xmlcalabash.runtime.XPipelineCall.run(XPipelineCall.java:94)
at com.xmlcalabash.runtime.XPipeline.doRun(XPipeline.java:232)
at com.xmlcalabash.runtime.XPipeline.run(XPipeline.java:142)
at com.xmlcalabash.drivers.Main.run(Main.java:369)
at com.xmlcalabash.drivers.Main.run(Main.java:112)
at com.xmlcalabash.drivers.Main.main(Main.java:83)
Message: Internal error evaluating template rule at line 627 in module file:/C:/docx2tex/docx2hub/xsl/wml2dbk.xsl
Message: DEBUG: RUNNING XSLT FOR docx2hub/01/20.wml-to-dbk
java.lang.NullPointerException: Cannot invoke "java.io.Reader.read(char[], int, int)" because "reader" is null
at net.sf.saxon.functions.UnparsedTextFunction.readFile(UnparsedTextFunction.java:182)
at net.sf.saxon.functions.UnparsedTextFunction.readFile(UnparsedTextFunction.java:76)
at net.sf.saxon.functions.UnparsedText.evalUnparsedText(UnparsedText.java:142)
at net.sf.saxon.functions.UnparsedText.call(UnparsedText.java:49)
at net.sf.saxon.functions.UnparsedText.call(UnparsedText.java:33)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:548)
at net.sf.saxon.expr.Expression.evaluateItem(Expression.java:852)
at net.sf.saxon.expr.parser.Evaluator$6.evaluate(Evaluator.java:173)
at net.sf.saxon.expr.SystemFunctionCall.evaluateArguments(SystemFunctionCall.java:454)
at net.sf.saxon.expr.FunctionCall.iterate(FunctionCall.java:546)
at net.sf.saxon.expr.parser.Evaluator$11.evaluate(Evaluator.java:290)
at net.sf.saxon.expr.parser.ExpressionTool.eagerEvaluate(ExpressionTool.java:317)
at net.sf.saxon.expr.TryCatch.iterate(TryCatch.java:279)
at net.sf.saxon.expr.instruct.ForEach.map(ForEach.java:584)
at net.sf.saxon.expr.ContextMappingIterator.next(ContextMappingIterator.java:61)
at net.sf.saxon.om.MemoSequence$ProgressiveIterator.next(MemoSequence.java:228)
at net.sf.saxon.functions.Exists$1.effectiveBooleanValue(Exists.java:69)
at net.sf.saxon.expr.instruct.Choose.choose(Choose.java:966)
at net.sf.saxon.expr.instruct.Choose.processLeavingTail(Choose.java:940)
at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:746)
at net.sf.saxon.expr.instruct.NamedTemplate.expand(NamedTemplate.java:264)
at net.sf.saxon.expr.instruct.CallTemplate.process(CallTemplate.java:372)
at net.sf.saxon.expr.parser.ExpressionTool.getIteratorFromProcessMethod(ExpressionTool.java:643)
at net.sf.saxon.expr.instruct.Instruction.iterate(Instruction.java:374)
at net.sf.saxon.expr.CardinalityChecker.evaluateItem(CardinalityChecker.java:283)
at net.sf.saxon.expr.ItemChecker.evaluateItem(ItemChecker.java:255)
at net.sf.saxon.expr.parser.Evaluator$6.evaluate(Evaluator.java:173)
at net.sf.saxon.expr.LetExpression.eval(LetExpression.java:545)
at net.sf.saxon.expr.LetExpression.processLeavingTail(LetExpression.java:737)
at net.sf.saxon.expr.instruct.TemplateRule.applyLeavingTail(TemplateRule.java:384)
at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:568)
at net.sf.saxon.trans.rules.TextOnlyCopyRuleSet.process(TextOnlyCopyRuleSet.java:72)
at net.sf.saxon.trans.Mode.applyTemplates(Mode.java:530)
at net.sf.saxon.trans.XsltController.applyTemplates(XsltController.java:661)
at net.sf.saxon.s9api.AbstractXsltTransformer.applyTemplatesToSource(AbstractXsltTransformer.java:360)
at net.sf.saxon.s9api.XsltTransformer.transform(XsltTransformer.java:349)
at com.xmlcalabash.library.XSLT.run(XSLT.java:230)
at com.xmlcalabash.runtime.XAtomicStep.run(XAtomicStep.java:388)
at com.xmlcalabash.runtime.XCompoundStep.run(XCompoundStep.java:267)
at com.xmlcalabash.runtime.XChoose.run(XChoose.java:135)
at com.xmlcalabash.runtime.XCompoundStep.run(XCompoundStep.java:267)
at com.xmlcalabash.runtime.XTry.run(XTry.java:199)
at com.xmlcalabash.runtime.XPipeline.doRun(XPipeline.java:232)
at com.xmlcalabash.runtime.XPipeline.run(XPipeline.java:142)
at com.xmlcalabash.runtime.XPipelineCall.run(XPipelineCall.java:94)
at com.xmlcalabash.runtime.XPipeline.doRun(XPipeline.java:232)
at com.xmlcalabash.runtime.XPipeline.run(XPipeline.java:142)
at com.xmlcalabash.runtime.XPipelineCall.run(XPipelineCall.java:94)
at com.xmlcalabash.runtime.XPipeline.doRun(XPipeline.java:232)
at com.xmlcalabash.runtime.XPipeline.run(XPipeline.java:142)
at com.xmlcalabash.drivers.Main.run(Main.java:369)
at com.xmlcalabash.drivers.Main.run(Main.java:112)
at com.xmlcalabash.drivers.Main.main(Main.java:83)
[main] ERROR com.xmlcalabash.drivers.Main - Pipeline failed: Internal error evaluating template rule at line 627 in module file:/C:/docx2tex/docx2hub/xsl/wml2dbk.xsl
[main] ERROR com.xmlcalabash.drivers.Main - Underlying exception: Cannot invoke "java.io.Reader.read(char[], int, int)" because "reader" is null

C:\docx2tex>java -version outputs:

java version "21.0.2" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 21.0.2+13-LTS-58)
Java HotSpot(TM) 64-Bit Server VM (build 21.0.2+13-LTS-58, mixed mode, sharing)

@mkraetke
Copy link
Member

Did you tried to replace the whitespace with an underscore in the filename? Does this work?

@XtrumE
Copy link
Author

XtrumE commented Feb 16, 2024

Did you tried to replace the whitespace with an underscore in the filename? Does this work?

Yes, I tried again with the file named "01.docx". However, the errors still occur.

@gimsieke
Copy link
Contributor

Can you send us the Word file? You can email it to [email protected]

@gimsieke
Copy link
Contributor

This is an error that is caused by Calabash 1.5.7. I addressed this error only in our mirror of the Calabash/Saxon10 repo, https://subversion.le-tex.de/common/github-mirror/calabash_saxon_10/, by reverting to Calabash 1.4.1.

I fixed another bug only in the mirror: Saxon 10.8 that was bundled had another issue, therefore I reverted to Saxon 10.7 (disguised as Saxon-HE-10.8.jar because the Calabash distro apparently has the jar name baked into it).

The relevant commits are r11405 for the Saxon jar and r10707 for the Calabash downgrade (plus today’s r11791 for calabash.bat because I forgot to refer to Calabash 1.4.1 instead of 1.5.7 in calabash.bat – we usually pay more attention to calabash.sh; calabash.bat often comes second wrt testing or bug fixing):

gerrit@Ada:~/w/Dev/tmp/docx2tex$ svn log -l9 https://subversion.le-tex.de/common/github-mirror/calabash_saxon_10/
------------------------------------------------------------------------
r11791 | gimsieke | 2024-02-17 10:12:14 +0100 (Sat, 17 Feb 2024) | 1 line

reflect downgrade to Calabash 1.4.1 due to 'java.io.Reader.read' error as reported in https://github.com/transpect/docx2tex/issues/105
------------------------------------------------------------------------
r11734 | gimsieke | 2024-02-13 15:17:33 +0100 (Tue, 13 Feb 2024) | 1 line

sync a bit with https://www.w3.org/TR/xproc/schemas/xproc.rng and https://www.w3.org/TR/xproc/schemas/steps.rng (wrapper-prefix etc.)
------------------------------------------------------------------------
r11632 | gimsieke | 2024-01-31 15:57:21 +0100 (Wed, 31 Jan 2024) | 1 line

commons-imaging-1.0-alpha3 in the classpath for image-props-extension
------------------------------------------------------------------------
r11405 | gimsieke | 2024-01-09 17:40:37 +0100 (Tue, 09 Jan 2024) | 1 line

Saxon HE 10.7 disguised as 10.8 because a 'Cannot copy a variable reference whose binding is unknown' (https://saxonica.plan.io/issues/4886) seems to reappear in 10.8
------------------------------------------------------------------------
r11404 | mkraetke | 2024-01-09 17:01:17 +0100 (Tue, 09 Jan 2024) | 1 line

catch exception because of buggy eps files
------------------------------------------------------------------------
r11402 | mkraetke | 2024-01-09 13:41:58 +0100 (Tue, 09 Jan 2024) | 1 line

revert to commons-imaging-1.0-alpha2 because of issues with eps files
------------------------------------------------------------------------
r11393 | ciuser | 2024-01-08 16:51:08 +0100 (Mon, 08 Jan 2024) | 1 line

fix classpath of image transform extension
------------------------------------------------------------------------
r10814 | fr4nze | 2023-11-07 16:21:22 +0100 (Tue, 07 Nov 2023) | 1 line

added row- and columnspacing for mtables
------------------------------------------------------------------------
r10707 | gimsieke | 2023-10-09 12:07:59 +0200 (Mon, 09 Oct 2023) | 1 line

revert to 1.4.1 and related http libs because there was 'java.lang.NullPointerException: Cannot invoke java.io.Reader.read(char[], int, int) because reader is null' when using unparsed-text()
------------------------------------------------------------------------

@mkraetke, you can either use the mirror or we can downgrade our calabash repos on Github to reflect the downgrades to Calabash and Saxon that I did in the mirror.

Calabash 1.5.7 is the most recent version on https://github.com/ndw/xmlcalabash1/releases

@XtrumE, may we forward the docx that you sent us to Norman Walsh so that he may look into the issue? I’d file a Calabash issue then. But a fix might take a long time.

For the time being, I don’t see an alternative to the downgrades that I did in the mirror repo, either by using the mirror repo itself or by applying them to the Github repo, too.

@XtrumE, if you need a quick fix and if you have an svn client, you can delete the calabash directory in docx2tex and instead

svn co https://subversion.le-tex.de/common/github-mirror/calabash_saxon_10/ calabash

mkraetke added a commit to transpect/calabash-distro that referenced this issue Feb 17, 2024
mkraetke added a commit that referenced this issue Feb 17, 2024
@mkraetke
Copy link
Member

Hi @XtrumE,

I've downgraded Calabash from 1.5.7 to 1.4.1. Please update to the latest version and confirm whether this resolves the issue.

Best, Martin

@XtrumE
Copy link
Author

XtrumE commented Feb 17, 2024

Hi @gimsieke and @mkraetke,

Thanks for your efforts. @gimsieke, please feel free to forward the file. I'd appreciate a solution in Calabash.

I have now updated to the latest version with the downgraded Calabash using git (I don't use svn at the moment). The error now does not occur anymore. But, I am afraid that another Calabash error arose. The log says:

'1.5.@SETLOCAL' is not recognized as an internal or external command,
operable program or batch file.
[main] ERROR com.xmlcalabash.drivers.Main - java.lang.ClassNotFoundException: org.xmlresolver.Resolver
[main] ERROR com.xmlcalabash.drivers.Main - Underlying exception: org.xmlresolver.Resolver

So, I need your help once more.

Best wishes!

@XtrumE
Copy link
Author

XtrumE commented Feb 17, 2024

... one additional remark: I have now tried it using an Ubuntu VM where it worked perfectly!

@gimsieke
Copy link
Contributor

Martin prepended the '1.5.' to the line by accident I guess. I removed it in the master branch.

@mkraetke
Copy link
Member

The line was reintroduced because of the downgrade mentioned above. Perhaps these mirrors should be also synced with our GitHub mirror to avoid these issues.

@MelchiorUU
Copy link

Facing the same issues unfortunately, but then the other way around ;-). Cloned the full repo today, so everything should be up-to-date.

OS: Windows 10
First issue:

'1.5.@SETLOCAL' is not recognized as an internal or external command, operable program or batch file.

Resolved this by installing Java 17:

java version "17.0.10" 2024-01-16 LTS
Java(TM) SE Runtime Environment (build 17.0.10+11-LTS-240)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.10+11-LTS-240, mixed mode, sharing)

Now I'm faced with:

PS C:\phd\Practical\docx2tex> .\d2t.bat .\Test_file.docx
starting docx2tex
Errors encountered while running docx2tex. Please see C:/phd/Practical/docx2tex/Test_file.log for details.

Log file:

[main] ERROR com.xmlcalabash.drivers.Main - java.lang.ClassNotFoundException: org.xmlresolver.Resolver
[main] ERROR com.xmlcalabash.drivers.Main - Underlying exception: org.xmlresolver.Resolver

When checking Calabash the version file says 1.3.2-100, which differs from the suggested 1.4.1 here.

The docx file is just a few words scribbled down, nothing special.

@MelchiorUU
Copy link

Reverted to the initial 1.9 release (https://github.com/transpect/docx2tex/releases/tag/v.1.9) and everything works fine. Tried this as the errors seemed to have to do with Saxon or Calabash versions being too old.

Maybe trying to fix this issue made it worse? :P

@mkraetke
Copy link
Member

mkraetke commented Apr 3, 2024

While cloning the repository, do you added --recursive so that the Git submodules are checked out as well?

$ git clone https://github.com/transpect/docx2tex --recursive

@MelchiorUU
Copy link

MelchiorUU commented Apr 3, 2024 via email

mkraetke added a commit that referenced this issue Apr 3, 2024
@mkraetke
Copy link
Member

mkraetke commented Apr 3, 2024

Thank you for the report. I've changed the entry for the reference to the resolver in the calabash.bat. Should work now.

@MelchiorUU
Copy link

Used Master and that seems to work without errors now.

@mkraetke mkraetke closed this as completed Apr 3, 2024
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

4 participants