DocBook to ePub

Stephan Witt st.witt at gmx.net
Sun Feb 7 11:47:36 UTC 2021


Am 07.02.2021 um 06:36 schrieb Thibaut Cuvelier <tcuvelier at lyx.org>:
> 
> 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.

Yes, it works. I’ve pushed another change (f55efc6951) to ensure all path names are quoted. Otherwise it fails for path names with spaces.

IMO it should work on windows too. Please check if it works for you. Thank you.

Stephan



More information about the lyx-devel mailing list