DocBook to ePub

Thibaut Cuvelier tcuvelier at lyx.org
Sun Feb 7 05:36:17 UTC 2021


On Sat, 6 Feb 2021 at 15:10, Pavel Sanda <sanda at lyx.org> wrote:

> On Sat, Feb 06, 2021 at 02:49:04PM +0100, Pavel Sanda wrote:
> > Command to execute:
> > "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar"
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmpnc1DfX
> > docbook2epub fails
> > sh: 1: java -jar
> /home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar Intro.xml
> /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmpnc1DfX: not found
> > Systemcall.cpp (291): Systemcall: 'python
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml"
> "Intro.epub"' finished with exit code 1
> > Error: Cannot convert file
> >
> > Not sure what went wrong, but going to terminal I do not see
> /tmp/tmpnc1DfX created.
> > Manually creating and running the java command leads to:
>
> The problem is not nonexistent dir, but qoutation for command, that's
> fixed by
> -    if os.system('"' + command + '"') != 0:
> +    if os.system(command) != 0:
>
> Now it continues by:
> Command to execute:
> "java" -jar "/home/lyx/lyx/devel/lib/scripts/../scripts/saxon6.5.5.jar"
> Intro.xml /home/lyx/lyx/devel/lib/scripts/../docbook/epub3/chunk.xsl
> base.dir=/tmp/tmp31wRYV
> Generated ePub contents.
> Writing /tmp/tmp31wRYV/OEBPS/toc.ncx for article
> Traceback (most recent call last):
>   File "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py", line 61, in
> <module>
>     for file in glob.glob(output_dir + '/**/*', recursive=True):
> TypeError: glob() got an unexpected keyword argument 'recursive'
> Systemcall.cpp (291): Systemcall: 'python
> "/home/lyx/lyx/devel/lib/scripts/docbook2epub.py" "java" "Intro.xml"
> "Intro.epub"' finished with exit code 1
> Error: Cannot convert file
>
> I am not pythonist, so I leave an unexpected keyword argument 'recursive'
> to someone else.
>

I've just pushed patches for these problems. Quotes are required in some
edge cases on Windows, so I added a switch based on the OS (a cleaner
solution would be to use the subprocess module, but its current API was
added in Python 3.5). The second error is due to an older version of
Python: I added a work-around that should work on all versions, and at
least it still works for me.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210207/6cfe7a6c/attachment.html>


More information about the lyx-devel mailing list