[LyX/master] ePub: copy images into the ePub archive.

Stephan Witt st.witt at gmx.net
Sun Feb 7 23:56:26 UTC 2021


Hi Thibaut,

sorry for having python 2.7 on Mac…

to overcome this:

00:39:31.061: Command to execute:
00:39:31.062: "xsltproc" -stringparam base.dir "/var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY" "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/../docbook/epub3/chunk.xsl" "In
00:39:31.062: tro.xml"
00:39:31.062: Generated ePub contents.
00:39:31.062: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/ar01s02.xhtml for section
00:39:31.062: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/ar01s03.xhtml for section(sec.Helfen)
00:39:31.062: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/index.xhtml for article
00:39:31.063: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/docbook-epub.css for article
00:39:31.063: Generating EPUB package files.
00:39:31.063: Generating image list ...
00:39:31.063: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/package.opf for article
00:39:31.063: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/../META-INF/container.xml for article
00:39:31.063: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/../mimetype for article
00:39:31.064: Generating NCX file ...
00:39:31.064: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpmUoLhY/OEBPS/toc.ncx for article
00:39:31.064: Traceback (most recent call last):
00:39:31.064:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 179, in <module>
00:39:31.064:     DocBookToEpub(sys.argv).transform()
00:39:31.064:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 174, in transform
00:39:31.064:     self.copy_images()
00:39:31.065:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 150, in copy_images
00:39:31.065:     self.change_image_paths(self.output_dir + '/OEBPS/package.opf')
00:39:31.065:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 132, in change_image_paths
00:39:31.065:     with open(file, 'r', encoding='utf8') as f:
00:39:31.065: TypeError: 'encoding' is an invalid keyword argument for this function
support/Systemcall.cpp (291): Systemcall: 'python "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py" none none "xsltproc" none "Intro.xml" "Intro.epub"' finished with exit code 1

I had to add

"from io import open"

to docbook2epub.py (patch attached). Next problem is the image path of the referenced clipart „Fussnote.png“:

00:52:28.850: Exportiere ...
00:52:28.855: (buffer-export epub)
00:52:28.981: python "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py" none none "xsltproc" none "Intro.xml" "Intro.epub"
00:52:29.188: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/ar01-toc.xhtml for article
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/ar01s02.xhtml for section
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/ar01s03.xhtml for section(sec.Helfen)
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/index.xhtml for article
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/docbook-epub.css for article
00:52:29.292: Generating EPUB package files.
00:52:29.292: Generating image list ...
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/package.opf for article
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/../META-INF/container.xml for article
00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/../mimetype for article
00:52:29.293: Generating NCX file ...
00:52:29.293: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/toc.ncx for article
00:52:29.397: Generating ePub with the following parameters:
00:52:29.397: /Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py
00:52:29.397: None
00:52:29.397: None
00:52:29.397: xsltproc
00:52:29.397: None
00:52:29.397: Intro.xml
00:52:29.398: Intro.epub
00:52:29.398: Temporary output directory: /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ
00:52:29.398: XSLT style sheet to use:
00:52:29.398: /Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/../docbook/epub3/chunk.xsl
00:52:29.398: Command to execute:
00:52:29.398: "xsltproc" -stringparam base.dir "/var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ" "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/../docbook/epub3/chunk.xsl" "In
00:52:29.399: tro.xml"
00:52:29.399: Generated ePub contents.
00:52:29.399: Traceback (most recent call last):
00:52:29.399:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 180, in <module>
00:52:29.399:     DocBookToEpub(sys.argv).transform()
00:52:29.399:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 175, in transform
00:52:29.399:     self.copy_images()
00:52:29.400:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 161, in copy_images
00:52:29.400:     shutil.copyfile(old, self.output_dir + '/OEBPS/' + new)
00:52:29.400:   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 96, in copyfile
00:52:29.400:     with open(src, 'rb') as fsrc:
00:52:29.400: IOError: [Errno 2] No such file or directory: u'../../../git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/doc/de/clipart/Fussnote.png’

Here I’m clueless.

Stephan

> Am 07.02.2021 um 20:00 schrieb Thibaut Cuvelier <tcuvelier at lyx.org>:
> 
> commit 7f4782d51d45b1a4770273930ff130b1d0d63091
> Author: Thibaut Cuvelier <tcuvelier at lyx.org>
> Date:   Sun Feb 7 20:00:31 2021 +0100
> 
>    ePub: copy images into the ePub archive.
> ---
> lib/scripts/docbook2epub.py |   57 ++++++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 56 insertions(+), 1 deletions(-)

-------------- next part --------------
A non-text attachment was scrubbed...
Name: docbook2epub-io-open.patch
Type: application/octet-stream
Size: 353 bytes
Desc: not available
URL: <http://lists.lyx.org/pipermail/lyx-devel/attachments/20210208/83c82773/attachment.obj>


More information about the lyx-devel mailing list