Skip unreadable assets without failing completely
|Assignee:||Joel Palmius||% Done:|
|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.
Traceback (most recent call last): File "./core\events3d.py", line 211, in callEvent method(event) 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.
#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.
Also available in: Atom