<div dir="ltr"><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, 8 Feb 2021 at 08:25, Stephan Witt <<a href="mailto:st.witt@gmx.net" target="_blank">st.witt@gmx.net</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Am 08.02.2021 um 06:42 schrieb Thibaut Cuvelier <<a href="mailto:tcuvelier@lyx.org" target="_blank">tcuvelier@lyx.org</a>>:<br>
> <br>
> On Mon, 8 Feb 2021 at 00:56, Stephan Witt <<a href="mailto:st.witt@gmx.net" target="_blank">st.witt@gmx.net</a>> wrote:<br>
> Next problem is the image path of the referenced clipart „Fussnote.png“:<br>
> <br>
> 00:52:28.850: Exportiere ...<br>
> 00:52:28.855: (buffer-export epub)<br>
> 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"<br>
> 00:52:29.188: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/ar01-toc.xhtml for article<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/ar01s02.xhtml for section<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/ar01s03.xhtml for section(sec.Helfen)<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/index.xhtml for article<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/docbook-epub.css for article<br>
> 00:52:29.292: Generating EPUB package files.<br>
> 00:52:29.292: Generating image list ...<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/package.opf for article<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/../META-INF/container.xml for article<br>
> 00:52:29.292: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/../mimetype for article<br>
> 00:52:29.293: Generating NCX file ...<br>
> 00:52:29.293: Writing /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ/OEBPS/toc.ncx for article<br>
> 00:52:29.397: Generating ePub with the following parameters:<br>
> 00:52:29.397: /Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py<br>
> 00:52:29.397: None<br>
> 00:52:29.397: None<br>
> 00:52:29.397: xsltproc<br>
> 00:52:29.397: None<br>
> 00:52:29.397: Intro.xml<br>
> 00:52:29.398: Intro.epub<br>
> 00:52:29.398: Temporary output directory: /var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ<br>
> 00:52:29.398: XSLT style sheet to use:<br>
> 00:52:29.398: /Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/../docbook/epub3/chunk.xsl<br>
> 00:52:29.398: Command to execute:<br>
> 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<br>
> 00:52:29.399: tro.xml"<br>
> 00:52:29.399: Generated ePub contents.<br>
> 00:52:29.399: Traceback (most recent call last):<br>
> 00:52:29.399:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 180, in <module><br>
> 00:52:29.399:     DocBookToEpub(sys.argv).transform()<br>
> 00:52:29.399:   File "/Users/stephan/git/lyx-build/LyX-2.4.0dev.app/Contents/Resources/scripts/docbook2epub.py", line 175, in transform<br>
> 00:52:29.399:     self.copy_images()<br>
> 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<br>
> 00:52:29.400:     shutil.copyfile(old, self.output_dir + '/OEBPS/' + new)<br>
> 00:52:29.400:   File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 96, in copyfile<br>
> 00:52:29.400:     with open(src, 'rb') as fsrc:<br>
> 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’<br>
> <br>
> Here I’m clueless.<br>
> <br>
> That one is trickier… Just to be sure: you tried to convert the German introduction, is that right? I can get an ePub with Fussnote.png on Windows, so there must be something platform-dependent.<br>
<br>
Yes. It’s the German Intro bundled with the package. The directory doc/de contains the Intro.lyx and there is the reference to the image clipart/Fussnote.png relative to the location of the LyX-file. The exported xml Intro.xml is somewhere outside the package and has the path to the image converted relative to that location. At this point the path is valid.<br>
<br>
> In your temporary folder (/var/folders/y8/l_k5f2ms4rngwbwvt9jp53hw0000gt/T/tmpxYSbzQ in your example), what does OEBPS/package.opf look like before it is rewritten by docbook2epub.py?<br>
<br>
Looks normal. There is a reference to the image.<br>
<br>
    <item id="idm133279468352" href="images/Fussnote.png" media-type="image/png“/><br>
<br>
> You may want to comment out self.copy_images() in line 175. What is the path to Fussnote.png there? <br>
<br>
The image name entry from self.get_images_from_package_opf is relative to the Intro.xml - the current directory of the python script is not the same. IMO that’s the problem.<br>
<br>
> Also: what is the actual path to Fussnote.png? <br>
> <br>
> I suppose this is due to the fact I assume that, originally, in package.opf, the paths are absolute. <br>
<br>
No, the path names are relative to the target directory.</blockquote><div><br></div><div>I've taken a closer look at the issue, but it's hard to debug without having access to the same OS as you… Isn't LyX supposed to copy all images to the temporary folder? <br></div><div><br></div><div>Anyway, I implemented more checks to find image files more often: b9f355fd. Does it work better for you?<br></div></div></div>