Quote:
Originally Posted by kovidgoyal
Not clear to me why the temporary directory matters? I assume you are only placing relative paths into the XML, so why should the base matter? But if you are placing the temporary directory into the XML, then there should be no problem doing it, as long as it is a unicode object and not a bytesstring.
|
There is no intention to put the temporary directory into the XML. It should be using relative paths.
The code in question is (with error checking removed):
Code:
for infile in self.get_html_names():
root = self.parsed(infile)
head = root.xpath('./xhtml:head',
namespaces={'xhtml': XHTML_NAMESPACE})
head = head[0]
elem = head.makeelement(
"{%s}link" % XHTML_NAMESPACE,
rel='stylesheet',
href=os.path.relpath(
name, os.path.dirname(infile)).replace(os.sep, '/'))
"name" will be "kte-css/stylehacks.css" and infile is something like "OEBPS/Text/@public@vhost@g@gutenberg@html@files@14105@14105-0-0.txt_split_000.html" (that's one of Leonatus's examples.) And "self" is a subclass of EpubContainer.
My assumption had been that the path generated and passed as "href" was the issue. But, I can't get it to break And I've pulled it apart into the steps and there is no sign of the temporary directory. I've also created a temporary directory like the one Leonatus has, and it works. This is on both a full 64bit Windows and 32bit Windows.
I'm assuming now that it is something that has been set earlier, but I'll have to track it down tomorrow.