Zim

ZimDesktop crashes on inserting an image in a table

Bug #1571759 reported by Marrin
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Zim
Confirmed
Medium
Unassigned

Bug Description

Hello,
if a zim-wiki file containing a table is modified in a regular text editor, ZimDesktop 0.65 on Linux crashes on opening the notebook, if the table contains a link to an image. Sample table:

| ColumnOneWithImage<| ColumnTwo |
|:-------------------|:----------|
| {{../santacl.jpg}} | text |

However, a table containing an image is not a problem for Zim parser - it can be exported just fine using command line version:

/opt/zim/zim.py --export \
  --format=html --template=Default \
  --output=/tmp/zim-bug/zim-export-to-html/html --index-page=sitemap \
  /home/user/Test/notebook.zim

 The resulting HTML works fine and displays the image in the table.

I have included in this report a sample Notebook ("Test") with a text file containing a table with an image; I included also the correct html and shell command used to generate it in "zim-export-to-html" folder.
Since the parser works fine from the command line I think it is a problem only for the GUI application, but I am not sure.

Thank you very much for the Zim program, I enjoy using it very much and it useful for me ( I am a teacher).

The crash dump report by ZimDesktop 0.65 on Linux AMD64 when opening that table with an image is:

This is zim 0.65
Platform: posix
Locale: en_US UTF-8
FS encoding: UTF-8
Python: (2, 7, 3, 'final', 0)
Gtk: (2, 24, 10)
Pygtk: (2, 24, 0)
Zim revision is:
  branch: zim-trunk
  revision: 805 <email address hidden>
  date: 2015-11-01 15:42:45 +0100

======= Traceback =======
  File "/opt/zim/zim/gui/pageview.py", line 4998, in set_page
    self.set_parsetree(tree, template)
  File "/opt/zim/zim/gui/pageview.py", line 5089, in set_parsetree
    buffer.set_parsetree(tree)
  File "/opt/zim/zim/gui/pageview.py", line 713, in set_parsetree
    self.insert_parsetree_at_cursor(tree)
  File "/opt/zim/zim/gui/pageview.py", line 780, in insert_parsetree_at_cursor
    self._insert_element_children(root, raw=raw)
  File "/opt/zim/zim/gui/pageview.py", line 937, in _insert_element_children
    obj = ObjectManager.get_object('table', element.attrib, element)
  File "/opt/zim/zim/objectmanager.py", line 81, in get_object
    obj = factory(attrib, text)
  File "/opt/zim/zim/plugins/tableeditor.py", line 133, in create_table
    (header, rows) = self._tabledom_to_list(text)
  File "/opt/zim/zim/plugins/tableeditor.py", line 149, in _tabledom_to_list
    row = [ElementTree.tostring(r, 'utf-8').replace('<td>', '').replace('</td>', '') for r in row]
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1127, in tostring
    ElementTree(element).write(file, encoding, method=method)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 821, in write
    serialize(write, self._root, encoding, qnames, namespaces)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 940, in _serialize_xml
    _serialize_xml(write, e, encoding, qnames, None)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 933, in _serialize_xml
    v = _escape_attrib(v, encoding)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1093, in _escape_attrib
    _raise_serialization_error(text)
  File "/usr/lib/python2.7/xml/etree/ElementTree.py", line 1053, in _raise_serialization_error
    "cannot serialize %r (type %s)" % (text, type(text).__name__)
TypeError: cannot serialize <UnixFile: /home/user/Test/santacl.jpg> (type UnixFile)

Revision history for this message
Marrin (pimla) wrote :
Changed in zim:
status: New → Confirmed
importance: Undecided → Medium
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.