Bug #1089

Skip unreadable assets without failing completely

Added by Joel Palmius about 2 years ago. Updated almost 2 years ago.

Status:AcceptedStart date:12/27/2016
Priority:LowDue date:
Assignee:Joel Palmius% Done:


Category:Code correctness
Target version:MakeHuman 1.1.2


If an asset file in the user's home directory is unreadable, for example because it contains latin1 encoded characters, the whole asset scan routine crashes and the asset list (even for system installed assets) fail to populate.

It would be more graceful to catch the exception and skip just the faulty file.

Stack trace:

Traceback (most recent call last):
  File "./core\events3d.py", line 211, in callEvent
  File "plugins/3_libraries_clothes_chooser.py", line 146, in onShow
    super(ClothesTaskView, self).onShow(event)
  File "./apps/gui\proxychooser.py", line 468, in onShow
    self.updateFileCache(self.getSearchPaths(), self.getFileExtensions())
  File "./lib\filecache.py", line 288, in updateFileCache
    self._filecache.update(search_paths, file_extensions, self._get_metadata_callback, remove_old_entries)
  File "./lib\filecache.py", line 153, in update
    self._cache[fileId] = (mtime,) + getMetadata(filepath)
  File "./lib\filecache.py", line 191, in _get_metadata_callback
    return self.getMetadataImpl(self.getMetadataFile(filename))
  File "./apps/gui\proxychooser.py", line 175, in getMetadataImpl
    return proxy.peekMetadata(filename, self.getProxyType())
  File "./shared\proxy.py", line 992, in peekMetadata
    for line in fp:
  File "C:\Python27\lib\codecs.py", line 699, in next
    return self.reader.next()
  File "C:\Python27\lib\codecs.py", line 630, in next
    line = self.readline()
  File "C:\Python27\lib\codecs.py", line 545, in readline
    data = self.read(readsize, firstline=True)
  File "C:\Python27\lib\codecs.py", line 492, in read
    newchars, decodedbytes = self.decode(data, self.errors)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xe5 in position 0: invalid continuation byte

But this is probably not happening very often, so setting priority to low.

Related issues

Related to MakeHuman - Bug #1029: Unicode in MH path still causing trouble Fixed 05/18/2016


#1 Updated by Joel Palmius about 2 years ago

  • Related to Bug #1029: Unicode in MH path still causing trouble added

#2 Updated by Joel Palmius almost 2 years ago

  • Target version changed from MakeHuman 1.1.1 to MakeHuman 1.1.2

This is unlikely to happen unless a user consciously changed a file name by pasting illegal characters.

But there is a remote possibility that a downloaded asset could have file name characters which would be illegal in the user's file system too.

Anyway, won't let this block 1.1.1.

#3 Updated by Jonas Hauquier almost 2 years ago

Indeed an error in loading a single asset shouldn't block the rest, but the stacktrace should be kept to allow debugging.

Also available in: Atom