def ufn(filename): "Convert a (bytes) filename to unicode for printing" assert not isinstance(filename, unicode) return filename.decode(sys.getfilesystemencoding(), 'replace')