google-code-export / labyrinth

Automatically exported from code.google.com/p/labyrinth
GNU General Public License v2.0
2 stars 0 forks source link

unicode decoding error (corrupt sample) #57

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Sadly, I do not know how exactly this problem can be reproduced. I was
working on a mind map and in some way, labyrinth started behaving funny
(don't remember exactly what). I quit labyrinth and started it again, to
find out that the mind map cannot be loaded. It spits this traceback:

Traceback (most recent call last):
  File "/usr/lib/python2.5/site-packages/labyrinth/Browser.py", line 203,
in open_row_cb
    self.open_selected_map ()
  File "/usr/lib/python2.5/site-packages/labyrinth/Browser.py", line 163,
in open_selected_map
    self.open_map (map)
  File "/usr/lib/python2.5/site-packages/labyrinth/Browser.py", line 147,
in open_map
    win = MainWindow.LabyrinthWindow (map.filename)
  File "/usr/lib/python2.5/site-packages/labyrinth/MainWindow.py", line
133, in __init__
    self.parse_file (filename)
  File "/usr/lib/python2.5/site-packages/labyrinth/MainWindow.py", line
516, in parse_file
    self.MainArea.load_thyself (top_element, doc)
  File "/usr/lib/python2.5/site-packages/labyrinth/MMapArea.py", line 826,
in load_thyself
    self.load_thought (node, TYPE_TEXT)
  File "/usr/lib/python2.5/site-packages/labyrinth/MMapArea.py", line 813,
in load_thought
    thought.load (node)
  File "/usr/lib/python2.5/site-packages/labyrinth/TextThought.py", line
962, in load
    self.rebuild_byte_table ()
  File "/usr/lib/python2.5/site-packages/labyrinth/TextThought.py", line
909, in rebuild_byte_table
    if str(tmp[current:current+blen].encode()) == str(self.text[z]):
UnicodeDecodeError: 'utf8' codec can't decode bytes in position 0-1:
unexpected end of data

Original issue reported on code.google.com by nekoh...@gmail.com on 17 Apr 2007 at 5:51

Attachments:

GoogleCodeExporter commented 9 years ago
Fixed in SVN Head:

2007-04-17 Don Scorgie <Don@Scorgie.org>

    * src/TextThought.py:
    -Later- Fix byte table rebuilding in the presence of "undecipherable" 
    characters as Python puts it.  Basically, add a try-except block to
    ensure the character is correctly tested

Original comment by DonScor...@gmail.com on 17 Apr 2007 at 6:26