← Back to team overview

zim-wiki team mailing list archive

Is python < 2.7 supported for export/indexing?

 

Dear all,

I am trying to export a zim notebook to html on a CentOS6 system (with python 2.6.6). What I find is that with --export, zim silently fails to create anything in the target directory other than the "_resources" directory. Using the -V and -D options doesn't show any errors.

I noticed from the debug output that the export uses the index database file. I then tried to create this first with 'zim --index -V -D', and got output like this for every page:

ERROR: Got an exception while indexing "<IndexPath: Home>":
Traceback (most recent call last):
  File "/public/sw/zim-0.61/lib/python2.6/site-packages/zim/index.py", line 723, in _do_update
    self._index_page(path, page)
  File "/public/sw/zim-0.61/lib/python2.6/site-packages/zim/index.py", line 828, in _index_page
    for type, href, _ in page.get_links():
  File "/public/sw/zim-0.61/lib/python2.6/site-packages/zim/notebook.py", line 2546, in get_links
    for elt in tree.findall(zim.formats.LINK):
File "/public/sw/zim-0.61/lib/python2.6/site-packages/zim/formats/__init__.py", line 523, in findall
    for elt in self._etree.iter(tag):
AttributeError: ElementTree instance has no attribute 'iter'
INFO: Indexed Home

and indeed the python docs for getiterator() and iter() show that the latter is new in version 2.7, so getiterator() should be used for earlier versions:

<https://docs.python.org/2/library/xml.etree.elementtree.html#xml.etree.ElementTree.Element.getiterator>

However, having run 'zim --index', if I run 'zim --export' all the pages are exported, in spite of the errors with the --index option.

Is running 'zim --index' prior to 'zim --export' likely to be a reliable way of doing the export with a python version less than 2.7? At the moment, the particular notebook only has a few pages, but it will grow.

Regards,
Peter.

--
Peter Keller                                     Tel.: +44 (0)1223 353033
Global Phasing Ltd.,                             Fax.: +44 (0)1223 366889
Sheraton House,
Castle Park,
Cambridge CB3 0AX
United Kingdom


Follow ups