Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-18-2013, 01:57 PM   #1
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
Conversion of odt produced from latex

I don't know if anyone else has come across this. I usually write documents in latex and use a couple of commands on the source files that output an .odt:

latexmk file.tex
mk4ht ebook file.tex

Works fine, except that calibre fails to convert it. Calibre works fine if I create a new odt in libreoffice however, so mk4ht is failing to do something.

This is the output from the conversion that fails:

Code:
Extracting ODT file...
Traceback (most recent call last):
  File "/usr/bin/calibre-parallel", line 20, in <module>
    sys.exit(main())
  File "/usr/lib64/calibre/calibre/utils/ipc/worker.py", line 189, in main
    result = func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 31, in gui_convert_override
    override_input_metadata=True)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
    plumber.run()
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plumber.py", line 1035, in run
    accelerators, tdir)
  File "/usr/lib64/calibre/calibre/customize/conversion.py", line 241, in __call__
    log, accelerators)
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/odt_input.py", line 23, in convert
    return Extract()(stream, '.', log)
  File "/usr/lib64/calibre/calibre/ebooks/odt/input.py", line 263, in __call__
    mi = get_metadata(stream, 'odt')
  File "/usr/lib64/calibre/calibre/ebooks/metadata/odt.py", line 165, in get_metadata
    parser.parse(StringIO(content))
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 107, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib64/python2.7/xml/sax/xmlreader.py", line 123, in parse
    self.feed(buffer)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 207, in feed
    self._parser.Parse(data, isFinal)
  File "/usr/lib64/python2.7/xml/sax/expatreader.py", line 381, in external_entity_ref
    "")
  File "/usr/lib64/python2.7/xml/sax/saxutils.py", line 304, in prepare_input_source
    f = urllib.urlopen(source.getSystemId())
  File "/usr/lib64/python2.7/urllib.py", line 86, in urlopen
    return opener.open(url)
  File "/usr/lib64/python2.7/urllib.py", line 207, in open
    return getattr(self, name)(url)
  File "/usr/lib64/python2.7/urllib.py", line 462, in open_file
    return self.open_local_file(url)
  File "/usr/lib64/python2.7/urllib.py", line 476, in open_local_file
    raise IOError(e.errno, e.strerror, e.filename)
IOError: [Errno 2] No such file or directory: 'office.dtd'
I looked for the file office.dtd in an .odt made in libreoffice but it doesn't exist there either, so I don't know what the problem is.

*Edit: I did find this: /opt/libreoffice3.6/share/dtd/officedocument/1_0/office.dtd
dawood is offline   Reply With Quote
Old 10-18-2013, 11:19 PM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...736e0c8edaf760
kovidgoyal is offline   Reply With Quote
Old 10-18-2013, 11:31 PM   #3
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
Thanks, that worked. But it leads to another error:

Code:
Traceback (most recent call last):
  File "/usr/bin/calibre-parallel", line 20, in <module>
    sys.exit(main())
  File "/usr/lib64/calibre/calibre/utils/ipc/worker.py", line 189, in main
    result = func(*args, **kwargs)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 31, in gui_convert_override
    override_input_metadata=True)
  File "/usr/lib64/calibre/calibre/gui2/convert/gui_conversion.py", line 25, in gui_convert
    plumber.run()
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plumber.py", line 1035, in run
    accelerators, tdir)
  File "/usr/lib64/calibre/calibre/customize/conversion.py", line 241, in __call__
    log, accelerators)
  File "/usr/lib64/calibre/calibre/ebooks/conversion/plugins/odt_input.py", line 23, in convert
    return Extract()(stream, '.', log)
  File "/usr/lib64/calibre/calibre/ebooks/odt/input.py", line 268, in __call__
    self.filter_load(stream, mi, log)
  File "/usr/lib64/calibre/calibre/ebooks/odt/input.py", line 241, in filter_load
    self.document = odLoad(odffile)
  File "/usr/lib64/calibre/odf/opendocument.py", line 610, in load
    mimetype = z.read('mimetype')
  File "/usr/lib64/python2.7/zipfile.py", line 869, in read
    return self.open(name, "r", pwd).read()
  File "/usr/lib64/python2.7/zipfile.py", line 892, in open
    zinfo = self.getinfo(name)
  File "/usr/lib64/python2.7/zipfile.py", line 859, in getinfo
    'There is no item named %r in the archive' % name)
KeyError: "There is no item named 'mimetype' in the archive"
I should probably grab the latest and build from git?
dawood is offline   Reply With Quote
Old 10-18-2013, 11:49 PM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...2204b3b66f2b81
kovidgoyal is offline   Reply With Quote
Old 10-19-2013, 12:29 AM   #5
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
Getting closer:

Code:
File "/usr/lib64/calibre/calibre/ebooks/odt/input.py", line 284, in __call__
    self.extract_pictures(zf)
  File "/usr/lib64/calibre/calibre/ebooks/odt/input.py", line 31, in extract_pictures
    with open(name, 'wb') as f:
IOError: [Errno 21] Is a directory: u'Pictures/'
The pictures are in a directory named Pictures

I'm wondering about converting latex -> html now since it's higher in the prefered input format list

Last edited by dawood; 10-19-2013 at 12:32 AM.
dawood is offline   Reply With Quote
Old 10-19-2013, 12:39 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Why dont you just post one of these odt files, it will go a lot faster that way. And yes, feel free to use html.
kovidgoyal is offline   Reply With Quote
Old 10-19-2013, 12:43 AM   #7
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
Hmm it seems htlatex can't do filenames with spaces...

odt attached

*Had to upload a new one - the old one was using a custom mk4ht method

I fixed the Manifest.dtd problem myself but it will stop at that error.
Attached Files
File Type: zip test.zip (107.1 KB, 205 views)

Last edited by dawood; 10-19-2013 at 12:48 AM.
dawood is offline   Reply With Quote
Old 10-19-2013, 12:49 AM   #8
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
This one is using an improved m4ht config:
Attached Files
File Type: zip test2.zip (106.7 KB, 225 views)
dawood is offline   Reply With Quote
Old 10-19-2013, 12:52 AM   #9
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
https://github.com/kovidgoyal/calibr...2c5bdcf4f682b3
kovidgoyal is offline   Reply With Quote
Old 10-19-2013, 12:56 AM   #10
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
It didn't reproduce my image
dawood is offline   Reply With Quote
Old 10-19-2013, 01:34 AM   #11
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 45,198
Karma: 27110894
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Works for me.
Attached Files
File Type: epub A Touch of Darkness.epub (105.0 KB, 213 views)
kovidgoyal is offline   Reply With Quote
Old 10-19-2013, 01:38 AM   #12
dawood
Enthusiast
dawood began at the beginning.
 
Posts: 26
Karma: 10
Join Date: Oct 2013
Device: none
It does I commented out the image code to test something...

Thanks for all your work
dawood is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
.epub to LaTeX Conversion _savage ePub 4 11-07-2013 04:06 PM
Image Lost During ODT > ePub Conversion Foothills Conversion 12 08-24-2012 08:26 AM
LaTeX to HTML conversion kongzifan Conversion 9 12-14-2011 04:41 PM
Footnotes in odt->epub conversion Bidibulle Calibre 4 01-18-2011 12:07 PM


All times are GMT -4. The time now is 09:54 PM.


MobileRead.com is a privately owned, operated and funded community.