What steps will reproduce the problem?
Instantiate FSError with a unicode value for msg. Cause __unicode__() to be
called on the instance.
What is the expected output? What do you see instead?
Expect to see the unicode representation of the error. Instead, it raises
TypeError for trying to decode Unicode.
What version of the product are you using? On what operating system?
Mac OSX fs==0.5.0
Please provide any additional information below.
Fix is simple:
def __unicode__(self):
keys = {}
for k,v in self.__dict__.iteritems():
if isinstance(v, six.binary_type):
v = v.decode(sys.getfilesystemencoding(), 'replace')
keys[k] = v
msg = self.msg
# The next two lines fix the issue
if isinstance(msg,unicode):
msg = msg.encode(sys.getfilesystemencoding())
return unicode(msg, encoding=sys.getfilesystemencoding(), errors='replace') % keys
Original issue reported on code.google.com by jmead...@box.com on 12 Sep 2014 at 11:11
Original issue reported on code.google.com by
jmead...@box.com
on 12 Sep 2014 at 11:11