Zim

Template Processing Error (Notebook -> markdown)

Bug #1132031 reported by Jason Wells
12
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Zim
Expired
Undecided
Unassigned

Bug Description

Zim 0.59
Kubuntu 12.10
Python 2.7.2

File -> Export -> Complete Notebook -> Format markdown with Template Default -> (I've tried Index Pages as both blank and Home)

A run-time error occurred while processing a template.
This can be e.g. due to the template calling functions that
are not available, or it can be a glitch in the program.

Error in "/usr/share/zim/templates/markdown/Default.markdown" line "2" at "page.body":

Traceback (most recent call last):
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 507, in process
    re = self.do_process(dict)
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 528, in do_process
    value = self.expr.evaluate(dict)
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 674, in evaluate
    return dict[self]
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 899, in __getitem__
    item = self._lookup_key(self._default, param)
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 890, in _lookup_key
    return getattr(branch, param.key)
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 946, in body
    def body(self): return self._treeproxy().body
  File "/usr/lib/pymodules/python2.7/zim/templates.py", line 1023, in body
    return ''.join(dumper.dump(body))
  File "/usr/lib/pymodules/python2.7/zim/formats/markdown.py", line 79, in dump
    self.dump_children(tree.getroot(), output)
  File "/usr/lib/pymodules/python2.7/zim/formats/markdown.py", line 138, in dump_children
    bullet = bullet_types[element.attrib.get('bullet', BULLET)]
KeyError: u'1.'

zim - D output

zim -D
INFO: This is zim 0.59
DEBUG: Python version is sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0)
DEBUG: Platform is posix
DEBUG: No bzr version-info found
DEBUG: Not running from a source dir
DEBUG: Set XDG_DATA_HOME to /home/<my username>/.local/share
DEBUG: Set XDG_DATA_DIRS to [<Dir: /usr/share/kde-plasma>, <Dir: /usr/local/share>, <Dir: /usr/share>]
DEBUG: Set XDG_CONFIG_HOME to /home/<my username>/.config
DEBUG: Set XDG_CONFIG_DIRS to [<Dir: /etc/xdg/xdg-kde-plasma>, <Dir: /etc/xdg>]
DEBUG: Set XDG_CACHE_HOME to /home/<my username>/.cache
DEBUG: Running command: gui
DEBUG: Loading config from: /home/<my location>/notebook.zim
DEBUG: Wrote /home/jason/.config/zim/notebooks.list
INFO: Opening default notebook
DEBUG: Remote call from 3676: <RemoteMethodCall: 3676: zim.ipc.Server(None).ping((), {})>
DEBUG: Remote call returned to 3676: ('ACK', 7534)
DEBUG: Remote call from 3676: <RemoteMethodCall: 3676: zim.ipc.Server(None).has_object((<RemoteObject: zim.gui.GtkInterface(file:///home/<my location)>,), {})>
DEBUG: Remote call returned to 3676: True
DEBUG: Remote call from 3676: <RemoteMethodCall: 3676: zim.gui.GtkInterface(file:///home/<my location>).present((None,), {})>
DEBUG: Remote call returned to 3676: None
DEBUG:
NOTE FOR BUG REPORTS:
        At this point zim has send the command to open a notebook to a
        background process and the current process will now quit.
        If this is the end of your debug output it is probably not useful
        for bug reports. Please close all zim windows, quit the
        zim trayicon (if any), and try again.

Revision history for this message
Jason Wells (8ason) wrote :

Did not have the same problem in Unity on Ubuntu 12.10 so perhaps it's a Zim meets KDE issue?

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote : Re: [Bug 1132031] Re: Template Processing Error (Notebook -> markdown)

For sure this has nothing to do with KDE. Could have to do with a
specific page in your export. If you have an example of a page
triggering this bug, please add it here.

Thanks,

Jaap

Changed in zim:
status: New → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Zim because there has been no activity for 60 days.]

Changed in zim:
status: Incomplete → Expired
Revision history for this message
Rajkumar S (rajkumars) wrote :

This bug affect me too:
Debian 7.2, lxde desktop.

This is zim 0.56
Python version is sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0)
Gtk version is (2, 24, 10)
Pygtk version is (2, 24, 0)
Platform is posix
Zim revision is:
  branch: pyzim-trunk
  revision: 533 <email address hidden>
  date: 2012-04-02 22:07:22 +0200

======= Traceback =======
  File "/usr/lib/python2.7/dist-packages/zim/gui/widgets.py", line 2397, in do_response
    destroy = self.do_response_ok()
  File "/usr/lib/python2.7/dist-packages/zim/gui/exportdialog.py", line 77, in do_response_ok
    exporter.export_all(dir, callback=lambda p: dialog.pulse(p.name))
  File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 122, in export_all
    self.export_page(dir, current, pages, use_namespace=True)
  File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 196, in export_page
    self.export_page_to_fh(fh, page, pages)
  File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 222, in export_page_to_fh
    lines = self.template.process(self.notebook, page, pages)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 371, in process
    output = GenericTemplate.process(self, dict)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 207, in process
    output = TextBuffer(self.tokens.process(dict))
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 419, in process
    output.extend(token.process(dict))
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 473, in process
    value = self.expr.evaluate(dict)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 602, in evaluate
    return dict[self]
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 802, in __getitem__
    item = self._lookup_key(self._default, param)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 793, in _lookup_key
    return getattr(branch, param.key)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 849, in body
    def body(self): return self._treeproxy().body
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 900, in body
    return ''.join(dumper.dump(body))
  File "/usr/lib/python2.7/dist-packages/zim/formats/latex.py", line 100, in dump
    self.dump_children(tree.getroot(), output)
  File "/usr/lib/python2.7/dist-packages/zim/formats/latex.py", line 146, in dump_children
    bullet = bullet_types[element.attrib['bullet']]
KeyError: u'1.'

Revision history for this message
Rajkumar S (rajkumars) wrote :

raj@host:~$ apt-cache show zim
Package: zim
Version: 0.56-1

Rajkumar S (rajkumars)
Changed in zim:
status: Expired → Confirmed
Revision history for this message
YPWang (blue119) wrote :

Hi Rajkumar,

Could you provide the example of page that is able to trigger this bug?

Thanks,
yp

Revision history for this message
Rajkumar S (rajkumars) wrote :

Hi YPWang,

The error occurred in a file with sensitive information, so I cannot share that file as such. I will try to create a minimal file which can reproduce this problem and share it here.

raj

Revision history for this message
Rajkumar S (rajkumars) wrote :

I am able to reproduce this bug in a very simple sample document. The document is:

Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: 2014-01-13T20:13:14+05:30

====== Home ======
Created Monday 13 January 2014

This is a test note book
1. Thsi is a test line
2. This is another test line.

The exception while I try to export this as a LaTeX document is:

This is zim 0.56
Python version is sys.version_info(major=2, minor=7, micro=3, releaselevel='final', serial=0)
Gtk version is (2, 24, 10)
Pygtk version is (2, 24, 0)
Platform is posix
Zim revision is:
  branch: pyzim-trunk
  revision: 533 <email address hidden>
  date: 2012-04-02 22:07:22 +0200

======= Traceback =======
  File "/usr/lib/python2.7/dist-packages/zim/gui/widgets.py", line 2397, in do_response
    destroy = self.do_response_ok()
  File "/usr/lib/python2.7/dist-packages/zim/gui/exportdialog.py", line 77, in do_response_ok
    exporter.export_all(dir, callback=lambda p: dialog.pulse(p.name))
  File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 131, in export_all
    self.export_page(dir, current, pages, use_namespace=True)
  File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 196, in export_page
    self.export_page_to_fh(fh, page, pages)
  File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 222, in export_page_to_fh
    lines = self.template.process(self.notebook, page, pages)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 371, in process
    output = GenericTemplate.process(self, dict)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 207, in process
    output = TextBuffer(self.tokens.process(dict))
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 419, in process
    output.extend(token.process(dict))
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 473, in process
    value = self.expr.evaluate(dict)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 602, in evaluate
    return dict[self]
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 802, in __getitem__
    item = self._lookup_key(self._default, param)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 793, in _lookup_key
    return getattr(branch, param.key)
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 849, in body
    def body(self): return self._treeproxy().body
  File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 900, in body
    return ''.join(dumper.dump(body))
  File "/usr/lib/python2.7/dist-packages/zim/formats/latex.py", line 100, in dump
    self.dump_children(tree.getroot(), output)
  File "/usr/lib/python2.7/dist-packages/zim/formats/latex.py", line 146, in dump_children
    bullet = bullet_types[element.attrib['bullet']]
KeyError: u'1.'

Do let me know if additional information is needed from me to nail this bug.

with regards,

raj

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :
Download full text (3.6 KiB)

Please be aware that this is an older version of zim. Can not reproduce
this bug in version 0.60, so probably it is already fixed by changes
introduced in between.

Regards,

jaap

On Mon, Jan 13, 2014 at 3:53 PM, Rajkumar S <email address hidden>wrote:

> I am able to reproduce this bug in a very simple sample document. The
> document is:
>
> Content-Type: text/x-zim-wiki
> Wiki-Format: zim 0.4
> Creation-Date: 2014-01-13T20:13:14+05:30
>
> ====== Home ======
> Created Monday 13 January 2014
>
> This is a test note book
> 1. Thsi is a test line
> 2. This is another test line.
>
>
> The exception while I try to export this as a LaTeX document is:
>
> This is zim 0.56
> Python version is sys.version_info(major=2, minor=7, micro=3,
> releaselevel='final', serial=0)
> Gtk version is (2, 24, 10)
> Pygtk version is (2, 24, 0)
> Platform is posix
> Zim revision is:
> branch: pyzim-trunk
> revision: 533 <email address hidden>
> date: 2012-04-02 22:07:22 +0200
>
> ======= Traceback =======
> File "/usr/lib/python2.7/dist-packages/zim/gui/widgets.py", line 2397,
> in do_response
> destroy = self.do_response_ok()
> File "/usr/lib/python2.7/dist-packages/zim/gui/exportdialog.py", line
> 77, in do_response_ok
> exporter.export_all(dir, callback=lambda p: dialog.pulse(p.name))
> File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 131, in
> export_all
> self.export_page(dir, current, pages, use_namespace=True)
> File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 196, in
> export_page
> self.export_page_to_fh(fh, page, pages)
> File "/usr/lib/python2.7/dist-packages/zim/exporter.py", line 222, in
> export_page_to_fh
> lines = self.template.process(self.notebook, page, pages)
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 371, in
> process
> output = GenericTemplate.process(self, dict)
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 207, in
> process
> output = TextBuffer(self.tokens.process(dict))
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 419, in
> process
> output.extend(token.process(dict))
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 473, in
> process
> value = self.expr.evaluate(dict)
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 602, in
> evaluate
> return dict[self]
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 802, in
> __getitem__
> item = self._lookup_key(self._default, param)
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 793, in
> _lookup_key
> return getattr(branch, param.key)
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 849, in
> body
> def body(self): return self._treeproxy().body
> File "/usr/lib/python2.7/dist-packages/zim/templates.py", line 900, in
> body
> return ''.join(dumper.dump(body))
> File "/usr/lib/python2.7/dist-packages/zim/formats/latex.py", line 100,
> in dump
> self.dump_children(tree.getroot(), output)
> File "/usr/lib/python2.7/dist-packages/zim/formats/latex.py", line 146,
> in dump_children
> bullet = b...

Read more...

Revision history for this message
Arthur Younger (ajryounger) wrote :

I have encountered the same problem with Zim0.6.0 on Windows.

I have traced it to some problem with the formatting of numbered lists.

Following on Raj's clue, I began building a simple new notebook incrementally, doing test exports at each stage.

Found that, when I pasted in a two item numbered list I got error output as reported above.

By deleting the numbering, the problem disappeared.

arthur

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Just ran it with zim 0.60 on windows 7. Inspected the debug output but no errors during export.

Completely puzzled what is going on and why it doesn't reproduce on my system.

Regards,

Jaap

INFO: Locale set to: en_US.cp1252
INFO: This is zim 0.60
DEBUG: Python version is sys.version_info(major=2, minor=7, micro=1, releaseleve
l='final', serial=0)
DEBUG: Platform is nt

Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Setting to "incomplete" since I can not reproduce it. I have some suspicion what causes it, but difficult to make a hard test due to timing issues.

At least ensured that code in dev branch is more robust - output is normalized before export, which should remove these errors, and if the error occurs it will not be fatal.

Please open a new report if a similar issue is seen in zim 0.61 (or latest version of pyzim-refactor dev branch).

Changed in zim:
status: Confirmed → Incomplete
Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for Zim because there has been no activity for 60 days.]

Changed in zim:
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.