← Back to team overview

zim-wiki team mailing list archive

Re: Is python < 2.7 supported for export/indexing?

 

Hello Peter,

We try to support python 2.6 as well, so I consider this a bug I will fix
right away.

The error occurs when links in a page are index. So probably you end up
with a valid index for the notebook structure, but without an index of
links. So in the export e.g. listing backlinks in the template probably
will fail.

Otherwise you should be fine.

Regards,

Jaap


On Tue, Sep 9, 2014 at 1:13 PM, Peter Keller <pkeller@xxxxxxxxxxxxxxxxx>
wrote:

> 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
>
> _______________________________________________
> Mailing list: https://launchpad.net/~zim-wiki
> Post to     : zim-wiki@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~zim-wiki
> More help   : https://help.launchpad.net/ListHelp
>

References