I\'m having problems supporting python2 and python3 on a type()
call. This demonstrates the problem:
from __future__ import unicode_literals
name=\
six.b
is written under the assumption that you won't use unicode_literals
(and that you'll pass a string literal to it, as the documentation states), so the Python 2 implementation is just def b(s): return s
as a Python 2 string literal is already a byte string.
Either don't use unicode_literals
in this module, or use (as a comment suggests) str(name)
. In Python 3, that is a no-op. In Python 2, it silently converts the unicode string to a byte string (assuming some encoding that I can't be bothered to remember, but it's a superset of ASCII so you should be fine).